Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-19 09:50:53

0001 // Module support interface
0002 
0003 #ifndef Py_MODSUPPORT_H
0004 #define Py_MODSUPPORT_H
0005 #ifdef __cplusplus
0006 extern "C" {
0007 #endif
0008 
0009 PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
0010 PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...);
0011 PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
0012                                             const char *, PY_CXX_CONST char * const *, ...);
0013 PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
0014 PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
0015                                               const char *, PY_CXX_CONST char * const *, va_list);
0016 
0017 PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *);
0018 PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
0019 PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
0020 PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
0021 
0022 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030a0000
0023 // Add an attribute with name 'name' and value 'obj' to the module 'mod.
0024 // On success, return 0.
0025 // On error, raise an exception and return -1.
0026 PyAPI_FUNC(int) PyModule_AddObjectRef(PyObject *mod, const char *name, PyObject *value);
0027 #endif   /* Py_LIMITED_API */
0028 
0029 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
0030 // Similar to PyModule_AddObjectRef() but steal a reference to 'value'.
0031 PyAPI_FUNC(int) PyModule_Add(PyObject *mod, const char *name, PyObject *value);
0032 #endif   /* Py_LIMITED_API */
0033 
0034 // Similar to PyModule_AddObjectRef() and PyModule_Add() but steal
0035 // a reference to 'value' on success and only on success.
0036 // Errorprone. Should not be used in new code.
0037 PyAPI_FUNC(int) PyModule_AddObject(PyObject *mod, const char *, PyObject *value);
0038 
0039 PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
0040 PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
0041 
0042 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
0043 /* New in 3.9 */
0044 PyAPI_FUNC(int) PyModule_AddType(PyObject *module, PyTypeObject *type);
0045 #endif /* Py_LIMITED_API */
0046 
0047 #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant((m), #c, (c))
0048 #define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant((m), #c, (c))
0049 
0050 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
0051 /* New in 3.5 */
0052 PyAPI_FUNC(int) PyModule_SetDocString(PyObject *, const char *);
0053 PyAPI_FUNC(int) PyModule_AddFunctions(PyObject *, PyMethodDef *);
0054 PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def);
0055 #endif
0056 
0057 #define Py_CLEANUP_SUPPORTED 0x20000
0058 
0059 #define PYTHON_API_VERSION 1013
0060 #define PYTHON_API_STRING "1013"
0061 /* The API version is maintained (independently from the Python version)
0062    so we can detect mismatches between the interpreter and dynamically
0063    loaded modules.  These are diagnosed by an error message but
0064    the module is still loaded (because the mismatch can only be tested
0065    after loading the module).  The error message is intended to
0066    explain the core dump a few seconds later.
0067 
0068    The symbol PYTHON_API_STRING defines the same value as a string
0069    literal.  *** PLEASE MAKE SURE THE DEFINITIONS MATCH. ***
0070 
0071    Please add a line or two to the top of this log for each API
0072    version change:
0073 
0074    22-Feb-2006  MvL     1013    PEP 353 - long indices for sequence lengths
0075 
0076    19-Aug-2002  GvR     1012    Changes to string object struct for
0077                                 interning changes, saving 3 bytes.
0078 
0079    17-Jul-2001  GvR     1011    Descr-branch, just to be on the safe side
0080 
0081    25-Jan-2001  FLD     1010    Parameters added to PyCode_New() and
0082                                 PyFrame_New(); Python 2.1a2
0083 
0084    14-Mar-2000  GvR     1009    Unicode API added
0085 
0086    3-Jan-1999   GvR     1007    Decided to change back!  (Don't reuse 1008!)
0087 
0088    3-Dec-1998   GvR     1008    Python 1.5.2b1
0089 
0090    18-Jan-1997  GvR     1007    string interning and other speedups
0091 
0092    11-Oct-1996  GvR     renamed Py_Ellipses to Py_Ellipsis :-(
0093 
0094    30-Jul-1996  GvR     Slice and ellipses syntax added
0095 
0096    23-Jul-1996  GvR     For 1.4 -- better safe than sorry this time :-)
0097 
0098    7-Nov-1995   GvR     Keyword arguments (should've been done at 1.3 :-( )
0099 
0100    10-Jan-1995  GvR     Renamed globals to new naming scheme
0101 
0102    9-Jan-1995   GvR     Initial version (incompatible with older API)
0103 */
0104 
0105 /* The PYTHON_ABI_VERSION is introduced in PEP 384. For the lifetime of
0106    Python 3, it will stay at the value of 3; changes to the limited API
0107    must be performed in a strictly backwards-compatible manner. */
0108 #define PYTHON_ABI_VERSION 3
0109 #define PYTHON_ABI_STRING "3"
0110 
0111 PyAPI_FUNC(PyObject *) PyModule_Create2(PyModuleDef*, int apiver);
0112 
0113 #ifdef Py_LIMITED_API
0114 #define PyModule_Create(module) \
0115         PyModule_Create2((module), PYTHON_ABI_VERSION)
0116 #else
0117 #define PyModule_Create(module) \
0118         PyModule_Create2((module), PYTHON_API_VERSION)
0119 #endif
0120 
0121 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
0122 /* New in 3.5 */
0123 PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
0124                                                 PyObject *spec,
0125                                                 int module_api_version);
0126 
0127 #ifdef Py_LIMITED_API
0128 #define PyModule_FromDefAndSpec(module, spec) \
0129     PyModule_FromDefAndSpec2((module), (spec), PYTHON_ABI_VERSION)
0130 #else
0131 #define PyModule_FromDefAndSpec(module, spec) \
0132     PyModule_FromDefAndSpec2((module), (spec), PYTHON_API_VERSION)
0133 #endif /* Py_LIMITED_API */
0134 
0135 #endif /* New in 3.5 */
0136 
0137 #ifndef Py_LIMITED_API
0138 #  define Py_CPYTHON_MODSUPPORT_H
0139 #  include "cpython/modsupport.h"
0140 #  undef Py_CPYTHON_MODSUPPORT_H
0141 #endif
0142 
0143 #ifdef __cplusplus
0144 }
0145 #endif
0146 #endif /* !Py_MODSUPPORT_H */