@@ -19,19 +19,6 @@ extern "C" {
1919#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT
2020#define Py_BuildValue _Py_BuildValue_SizeT
2121#define Py_VaBuildValue _Py_VaBuildValue_SizeT
22- #ifndef Py_LIMITED_API
23- #define _Py_VaBuildStack _Py_VaBuildStack_SizeT
24- #endif
25- #else
26- #ifndef Py_LIMITED_API
27- PyAPI_FUNC (PyObject * ) _Py_VaBuildValue_SizeT (const char * , va_list );
28- PyAPI_FUNC (PyObject * * ) _Py_VaBuildStack_SizeT (
29- PyObject * * small_stack ,
30- Py_ssize_t small_stack_len ,
31- const char * format ,
32- va_list va ,
33- Py_ssize_t * p_nargs );
34- #endif /* !Py_LIMITED_API */
3522#endif
3623
3724/* Due to a glitch in 3.2, the _SizeT versions weren't exported from the DLL. */
@@ -51,97 +38,8 @@ PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
5138
5239
5340#define ANY_VARARGS (n ) (n == PY_SSIZE_T_MAX)
54- #ifndef Py_LIMITED_API
55- PyAPI_FUNC (int ) _PyArg_UnpackStack (
56- PyObject * const * args ,
57- Py_ssize_t nargs ,
58- const char * name ,
59- Py_ssize_t min ,
60- Py_ssize_t max ,
61- ...);
62-
63- PyAPI_FUNC (int ) _PyArg_NoKeywords (const char * funcname , PyObject * kwargs );
64- PyAPI_FUNC (int ) _PyArg_NoKwnames (const char * funcname , PyObject * kwnames );
65- PyAPI_FUNC (int ) _PyArg_NoPositional (const char * funcname , PyObject * args );
66- #define _PyArg_NoKeywords (funcname , kwargs ) \
67- ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs)))
68- #define _PyArg_NoKwnames (funcname , kwnames ) \
69- ((kwnames) == NULL || _PyArg_NoKwnames((funcname), (kwnames)))
70- #define _PyArg_NoPositional (funcname , args ) \
71- ((args) == NULL || _PyArg_NoPositional((funcname), (args)))
72-
73- PyAPI_FUNC (void ) _PyArg_BadArgument (const char * , const char * , const char * , PyObject * );
74- PyAPI_FUNC (int ) _PyArg_CheckPositional (const char * , Py_ssize_t ,
75- Py_ssize_t , Py_ssize_t );
76- #define _PyArg_CheckPositional (funcname , nargs , min , max ) \
77- ((!ANY_VARARGS(max) && (min) <= (nargs) && (nargs) <= (max)) \
78- || _PyArg_CheckPositional((funcname), (nargs), (min), (max)))
79-
80- #endif
8141
8242PyAPI_FUNC (PyObject * ) Py_VaBuildValue (const char * , va_list );
83- #ifndef Py_LIMITED_API
84- PyAPI_FUNC (PyObject * * ) _Py_VaBuildStack (
85- PyObject * * small_stack ,
86- Py_ssize_t small_stack_len ,
87- const char * format ,
88- va_list va ,
89- Py_ssize_t * p_nargs );
90- #endif
91-
92- #ifndef Py_LIMITED_API
93- typedef struct _PyArg_Parser {
94- const char * format ;
95- const char * const * keywords ;
96- const char * fname ;
97- const char * custom_msg ;
98- int pos ; /* number of positional-only arguments */
99- int min ; /* minimal number of arguments */
100- int max ; /* maximal number of positional arguments */
101- PyObject * kwtuple ; /* tuple of keyword parameter names */
102- struct _PyArg_Parser * next ;
103- } _PyArg_Parser ;
104- #ifdef PY_SSIZE_T_CLEAN
105- #define _PyArg_ParseTupleAndKeywordsFast _PyArg_ParseTupleAndKeywordsFast_SizeT
106- #define _PyArg_ParseStack _PyArg_ParseStack_SizeT
107- #define _PyArg_ParseStackAndKeywords _PyArg_ParseStackAndKeywords_SizeT
108- #define _PyArg_VaParseTupleAndKeywordsFast _PyArg_VaParseTupleAndKeywordsFast_SizeT
109- #endif
110- PyAPI_FUNC (int ) _PyArg_ParseTupleAndKeywordsFast (PyObject * , PyObject * ,
111- struct _PyArg_Parser * , ...);
112- PyAPI_FUNC (int ) _PyArg_ParseStack (
113- PyObject * const * args ,
114- Py_ssize_t nargs ,
115- const char * format ,
116- ...);
117- PyAPI_FUNC (int ) _PyArg_ParseStackAndKeywords (
118- PyObject * const * args ,
119- Py_ssize_t nargs ,
120- PyObject * kwnames ,
121- struct _PyArg_Parser * ,
122- ...);
123- PyAPI_FUNC (int ) _PyArg_VaParseTupleAndKeywordsFast (PyObject * , PyObject * ,
124- struct _PyArg_Parser * , va_list );
125- PyAPI_FUNC (PyObject * const * ) _PyArg_UnpackKeywords (
126- PyObject * const * args , Py_ssize_t nargs ,
127- PyObject * kwargs , PyObject * kwnames ,
128- struct _PyArg_Parser * parser ,
129- int minpos , int maxpos , int minkw ,
130- PyObject * * buf );
131-
132- PyAPI_FUNC (PyObject * const * ) _PyArg_UnpackKeywordsWithVararg (
133- PyObject * const * args , Py_ssize_t nargs ,
134- PyObject * kwargs , PyObject * kwnames ,
135- struct _PyArg_Parser * parser ,
136- int minpos , int maxpos , int minkw ,
137- int vararg , PyObject * * buf );
138-
139- #define _PyArg_UnpackKeywords (args , nargs , kwargs , kwnames , parser , minpos , maxpos , minkw , buf ) \
140- (((minkw) == 0 && (kwargs) == NULL && (kwnames) == NULL && \
141- (minpos) <= (nargs) && (nargs) <= (maxpos) && args != NULL) ? (args) : \
142- _PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
143- (minpos), (maxpos), (minkw), (buf)))
144- #endif /* Py_LIMITED_API */
14543
14644// Add an attribute with name 'name' and value 'obj' to the module 'mod.
14745// On success, return 0 on success.
@@ -154,10 +52,12 @@ PyAPI_FUNC(int) PyModule_AddObject(PyObject *mod, const char *, PyObject *value)
15452
15553PyAPI_FUNC (int ) PyModule_AddIntConstant (PyObject * , const char * , long );
15654PyAPI_FUNC (int ) PyModule_AddStringConstant (PyObject * , const char * , const char * );
55+
15756#if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 >= 0x03090000
15857/* New in 3.9 */
15958PyAPI_FUNC (int ) PyModule_AddType (PyObject * module , PyTypeObject * type );
16059#endif /* Py_LIMITED_API */
60+
16161#define PyModule_AddIntMacro (m , c ) PyModule_AddIntConstant(m, #c, c)
16262#define PyModule_AddStringMacro (m , c ) PyModule_AddStringConstant(m, #c, c)
16363
@@ -231,9 +131,6 @@ PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def);
231131#endif
232132
233133PyAPI_FUNC (PyObject * ) PyModule_Create2 (PyModuleDef * , int apiver );
234- #ifndef Py_LIMITED_API
235- PyAPI_FUNC (PyObject * ) _PyModule_CreateInitialized (PyModuleDef * , int apiver );
236- #endif
237134
238135#ifdef Py_LIMITED_API
239136#define PyModule_Create (module ) \
@@ -256,10 +153,13 @@ PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
256153#define PyModule_FromDefAndSpec (module , spec ) \
257154 PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION)
258155#endif /* Py_LIMITED_API */
156+
259157#endif /* New in 3.5 */
260158
261159#ifndef Py_LIMITED_API
262- PyAPI_DATA (const char * ) _Py_PackageContext ;
160+ # define Py_CPYTHON_MODSUPPORT_H
161+ # include "cpython/modsupport.h"
162+ # undef Py_CPYTHON_MODSUPPORT_H
263163#endif
264164
265165#ifdef __cplusplus
0 commit comments