annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/modsupport.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1
jpayne@69 2 #ifndef Py_MODSUPPORT_H
jpayne@69 3 #define Py_MODSUPPORT_H
jpayne@69 4 #ifdef __cplusplus
jpayne@69 5 extern "C" {
jpayne@69 6 #endif
jpayne@69 7
jpayne@69 8 /* Module support interface */
jpayne@69 9
jpayne@69 10 #include <stdarg.h>
jpayne@69 11
jpayne@69 12 /* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier
jpayne@69 13 to mean Py_ssize_t */
jpayne@69 14 #ifdef PY_SSIZE_T_CLEAN
jpayne@69 15 #define PyArg_Parse _PyArg_Parse_SizeT
jpayne@69 16 #define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
jpayne@69 17 #define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
jpayne@69 18 #define PyArg_VaParse _PyArg_VaParse_SizeT
jpayne@69 19 #define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
jpayne@69 20 #define Py_BuildValue _Py_BuildValue_SizeT
jpayne@69 21 #define Py_VaBuildValue _Py_VaBuildValue_SizeT
jpayne@69 22 #ifndef Py_LIMITED_API
jpayne@69 23 #define _Py_VaBuildStack _Py_VaBuildStack_SizeT
jpayne@69 24 #endif
jpayne@69 25 #else
jpayne@69 26 #ifndef Py_LIMITED_API
jpayne@69 27 PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
jpayne@69 28 PyAPI_FUNC(PyObject **) _Py_VaBuildStack_SizeT(
jpayne@69 29 PyObject **small_stack,
jpayne@69 30 Py_ssize_t small_stack_len,
jpayne@69 31 const char *format,
jpayne@69 32 va_list va,
jpayne@69 33 Py_ssize_t *p_nargs);
jpayne@69 34 #endif /* !Py_LIMITED_API */
jpayne@69 35 #endif
jpayne@69 36
jpayne@69 37 /* Due to a glitch in 3.2, the _SizeT versions weren't exported from the DLL. */
jpayne@69 38 #if !defined(PY_SSIZE_T_CLEAN) || !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
jpayne@69 39 PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
jpayne@69 40 PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...);
jpayne@69 41 PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
jpayne@69 42 const char *, char **, ...);
jpayne@69 43 PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
jpayne@69 44 PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
jpayne@69 45 const char *, char **, va_list);
jpayne@69 46 #endif
jpayne@69 47 PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *);
jpayne@69 48 PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
jpayne@69 49 PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
jpayne@69 50 PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
jpayne@69 51
jpayne@69 52
jpayne@69 53 #ifndef Py_LIMITED_API
jpayne@69 54 PyAPI_FUNC(int) _PyArg_UnpackStack(
jpayne@69 55 PyObject *const *args,
jpayne@69 56 Py_ssize_t nargs,
jpayne@69 57 const char *name,
jpayne@69 58 Py_ssize_t min,
jpayne@69 59 Py_ssize_t max,
jpayne@69 60 ...);
jpayne@69 61
jpayne@69 62 PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs);
jpayne@69 63 PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args);
jpayne@69 64 #define _PyArg_NoKeywords(funcname, kwargs) \
jpayne@69 65 ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
jpayne@69 66 #define _PyArg_NoPositional(funcname, args) \
jpayne@69 67 ((args) == NULL || _PyArg_NoPositional((funcname), (args)))
jpayne@69 68
jpayne@69 69 PyAPI_FUNC(void) _PyArg_BadArgument(const char *, const char *, const char *, PyObject *);
jpayne@69 70 PyAPI_FUNC(int) _PyArg_CheckPositional(const char *, Py_ssize_t,
jpayne@69 71 Py_ssize_t, Py_ssize_t);
jpayne@69 72 #define _PyArg_CheckPositional(funcname, nargs, min, max) \
jpayne@69 73 (((min) <= (nargs) && (nargs) <= (max)) \
jpayne@69 74 || _PyArg_CheckPositional((funcname), (nargs), (min), (max)))
jpayne@69 75
jpayne@69 76 #endif
jpayne@69 77
jpayne@69 78 PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
jpayne@69 79 #ifndef Py_LIMITED_API
jpayne@69 80 PyAPI_FUNC(PyObject **) _Py_VaBuildStack(
jpayne@69 81 PyObject **small_stack,
jpayne@69 82 Py_ssize_t small_stack_len,
jpayne@69 83 const char *format,
jpayne@69 84 va_list va,
jpayne@69 85 Py_ssize_t *p_nargs);
jpayne@69 86 #endif
jpayne@69 87
jpayne@69 88 #ifndef Py_LIMITED_API
jpayne@69 89 typedef struct _PyArg_Parser {
jpayne@69 90 const char *format;
jpayne@69 91 const char * const *keywords;
jpayne@69 92 const char *fname;
jpayne@69 93 const char *custom_msg;
jpayne@69 94 int pos; /* number of positional-only arguments */
jpayne@69 95 int min; /* minimal number of arguments */
jpayne@69 96 int max; /* maximal number of positional arguments */
jpayne@69 97 PyObject *kwtuple; /* tuple of keyword parameter names */
jpayne@69 98 struct _PyArg_Parser *next;
jpayne@69 99 } _PyArg_Parser;
jpayne@69 100 #ifdef PY_SSIZE_T_CLEAN
jpayne@69 101 #define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT
jpayne@69 102 #define _PyArg_ParseStack _PyArg_ParseStack_SizeT
jpayne@69 103 #define _PyArg_ParseStackAndKeywords _PyArg_ParseStackAndKeywords_SizeT
jpayne@69 104 #define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT
jpayne@69 105 #endif
jpayne@69 106 PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
jpayne@69 107 struct _PyArg_Parser *, ...);
jpayne@69 108 PyAPI_FUNC(int) _PyArg_ParseStack(
jpayne@69 109 PyObject *const *args,
jpayne@69 110 Py_ssize_t nargs,
jpayne@69 111 const char *format,
jpayne@69 112 ...);
jpayne@69 113 PyAPI_FUNC(int) _PyArg_ParseStackAndKeywords(
jpayne@69 114 PyObject *const *args,
jpayne@69 115 Py_ssize_t nargs,
jpayne@69 116 PyObject *kwnames,
jpayne@69 117 struct _PyArg_Parser *,
jpayne@69 118 ...);
jpayne@69 119 PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywordsFast(PyObject *, PyObject *,
jpayne@69 120 struct _PyArg_Parser *, va_list);
jpayne@69 121 PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
jpayne@69 122 PyObject *const *args, Py_ssize_t nargs,
jpayne@69 123 PyObject *kwargs, PyObject *kwnames,
jpayne@69 124 struct _PyArg_Parser *parser,
jpayne@69 125 int minpos, int maxpos, int minkw,
jpayne@69 126 PyObject **buf);
jpayne@69 127 #define _PyArg_UnpackKeywords(args, nargs, kwargs, kwnames, parser, minpos, maxpos, minkw, buf) \
jpayne@69 128 (((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
jpayne@69 129 (minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \
jpayne@69 130 _PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
jpayne@69 131 (minpos), (maxpos), (minkw), (buf)))
jpayne@69 132
jpayne@69 133 void _PyArg_Fini(void);
jpayne@69 134 #endif /* Py_LIMITED_API */
jpayne@69 135
jpayne@69 136 PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
jpayne@69 137 PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
jpayne@69 138 PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
jpayne@69 139 #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
jpayne@69 140 #define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
jpayne@69 141
jpayne@69 142 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
jpayne@69 143 /* New in 3.5 */
jpayne@69 144 PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *);
jpayne@69 145 PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *);
jpayne@69 146 PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def);
jpayne@69 147 #endif
jpayne@69 148
jpayne@69 149 #define Py_CLEANUP_SUPPORTED 0x20000
jpayne@69 150
jpayne@69 151 #define PYTHON_API_VERSION 1013
jpayne@69 152 #define PYTHON_API_STRING "1013"
jpayne@69 153 /* The API version is maintained (independently from the Python version)
jpayne@69 154 so we can detect mismatches between the interpreter and dynamically
jpayne@69 155 loaded modules. These are diagnosed by an error message but
jpayne@69 156 the module is still loaded (because the mismatch can only be tested
jpayne@69 157 after loading the module). The error message is intended to
jpayne@69 158 explain the core dump a few seconds later.
jpayne@69 159
jpayne@69 160 The symbol PYTHON_API_STRING defines the same value as a string
jpayne@69 161 literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
jpayne@69 162
jpayne@69 163 Please add a line or two to the top of this log for each API
jpayne@69 164 version change:
jpayne@69 165
jpayne@69 166 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths
jpayne@69 167
jpayne@69 168 19-Aug-2002 GvR 1012 Changes to string object struct for
jpayne@69 169 interning changes, saving 3 bytes.
jpayne@69 170
jpayne@69 171 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side
jpayne@69 172
jpayne@69 173 25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and
jpayne@69 174 PyFrame_New(); Python 2.1a2
jpayne@69 175
jpayne@69 176 14-Mar-2000 GvR 1009 Unicode API added
jpayne@69 177
jpayne@69 178 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!)
jpayne@69 179
jpayne@69 180 3-Dec-1998 GvR 1008 Python 1.5.2b1
jpayne@69 181
jpayne@69 182 18-Jan-1997 GvR 1007 string interning and other speedups
jpayne@69 183
jpayne@69 184 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-(
jpayne@69 185
jpayne@69 186 30-Jul-1996 GvR Slice and ellipses syntax added
jpayne@69 187
jpayne@69 188 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-)
jpayne@69 189
jpayne@69 190 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( )
jpayne@69 191
jpayne@69 192 10-Jan-1995 GvR Renamed globals to new naming scheme
jpayne@69 193
jpayne@69 194 9-Jan-1995 GvR Initial version (incompatible with older API)
jpayne@69 195 */
jpayne@69 196
jpayne@69 197 /* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of
jpayne@69 198 Python 3, it will stay at the value of 3; changes to the limited API
jpayne@69 199 must be performed in a strictly backwards-compatible manner. */
jpayne@69 200 #define PYTHON_ABI_VERSION 3
jpayne@69 201 #define PYTHON_ABI_STRING "3"
jpayne@69 202
jpayne@69 203 #ifdef Py_TRACE_REFS
jpayne@69 204 /* When we are tracing reference counts, rename module creation functions so
jpayne@69 205 modules compiled with incompatible settings will generate a
jpayne@69 206 link-time error. */
jpayne@69 207 #define PyModule_Create2 PyModule_Create2TraceRefs
jpayne@69 208 #define PyModule_FromDefAndSpec2 PyModule_FromDefAndSpec2TraceRefs
jpayne@69 209 #endif
jpayne@69 210
jpayne@69 211 PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*,
jpayne@69 212 int apiver);
jpayne@69 213 #ifndef Py_LIMITED_API
jpayne@69 214 PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(struct PyModuleDef*,
jpayne@69 215 int apiver);
jpayne@69 216 #endif
jpayne@69 217
jpayne@69 218 #ifdef Py_LIMITED_API
jpayne@69 219 #define PyModule_Create(module) \
jpayne@69 220 PyModule_Create2(module, PYTHON_ABI_VERSION)
jpayne@69 221 #else
jpayne@69 222 #define PyModule_Create(module) \
jpayne@69 223 PyModule_Create2(module, PYTHON_API_VERSION)
jpayne@69 224 #endif
jpayne@69 225
jpayne@69 226 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
jpayne@69 227 /* New in 3.5 */
jpayne@69 228 PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
jpayne@69 229 PyObject *spec,
jpayne@69 230 int module_api_version);
jpayne@69 231
jpayne@69 232 #ifdef Py_LIMITED_API
jpayne@69 233 #define PyModule_FromDefAndSpec(module, spec) \
jpayne@69 234 PyModule_FromDefAndSpec2(module, spec, PYTHON_ABI_VERSION)
jpayne@69 235 #else
jpayne@69 236 #define PyModule_FromDefAndSpec(module, spec) \
jpayne@69 237 PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION)
jpayne@69 238 #endif /* Py_LIMITED_API */
jpayne@69 239 #endif /* New in 3.5 */
jpayne@69 240
jpayne@69 241 #ifndef Py_LIMITED_API
jpayne@69 242 PyAPI_DATA(const char *) _Py_PackageContext;
jpayne@69 243 #endif
jpayne@69 244
jpayne@69 245 #ifdef __cplusplus
jpayne@69 246 }
jpayne@69 247 #endif
jpayne@69 248 #endif /* !Py_MODSUPPORT_H */