diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-06-02 23:06:47 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-06-02 23:06:47 (GMT) |
commit | ca829102213c466ffecb1e464be5c8cb3967d961 (patch) | |
tree | 98993ee236ae34d2882fbae2c8d66cea899b12f3 /Include/moduleobject.h | |
parent | 72ea27c89ba48b914e80743ee3391ed0fdda82be (diff) | |
download | cpython-ca829102213c466ffecb1e464be5c8cb3967d961.zip cpython-ca829102213c466ffecb1e464be5c8cb3967d961.tar.gz cpython-ca829102213c466ffecb1e464be5c8cb3967d961.tar.bz2 |
Issue 24365: Conditionalize PEP 489 additions to the stable ABI
Patch by Petr Viktorin.
Diffstat (limited to 'Include/moduleobject.h')
-rw-r--r-- | Include/moduleobject.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Include/moduleobject.h b/Include/moduleobject.h index dbbf581..229d7fa 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -30,8 +30,11 @@ PyAPI_FUNC(void) _PyModule_ClearDict(PyObject *); PyAPI_FUNC(struct PyModuleDef*) PyModule_GetDef(PyObject*); PyAPI_FUNC(void*) PyModule_GetState(PyObject*); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 +/* New in 3.5 */ PyAPI_FUNC(PyObject *) PyModuleDef_Init(struct PyModuleDef*); PyAPI_DATA(PyTypeObject) PyModuleDef_Type; +#endif typedef struct PyModuleDef_Base { PyObject_HEAD @@ -47,30 +50,35 @@ typedef struct PyModuleDef_Base { NULL, /* m_copy */ \ } +struct PyModuleDef_Slot; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 +/* New in 3.5 */ typedef struct PyModuleDef_Slot{ int slot; void *value; } PyModuleDef_Slot; +#define Py_mod_create 1 +#define Py_mod_exec 2 + +#ifndef Py_LIMITED_API +#define _Py_mod_LAST_SLOT 2 +#endif + +#endif /* New in 3.5 */ + typedef struct PyModuleDef{ PyModuleDef_Base m_base; const char* m_name; const char* m_doc; Py_ssize_t m_size; PyMethodDef *m_methods; - PyModuleDef_Slot* m_slots; + struct PyModuleDef_Slot* m_slots; traverseproc m_traverse; inquiry m_clear; freefunc m_free; }PyModuleDef; -#define Py_mod_create 1 -#define Py_mod_exec 2 - -#ifndef Py_LIMITED_API -#define _Py_mod_LAST_SLOT 2 -#endif - #ifdef __cplusplus } #endif |