From ca829102213c466ffecb1e464be5c8cb3967d961 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Tue, 2 Jun 2015 19:06:47 -0400 Subject: Issue 24365: Conditionalize PEP 489 additions to the stable ABI Patch by Petr Viktorin. --- Include/moduleobject.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'Include/moduleobject.h') diff --git a/Include/moduleobject.h b/Include/moduleobject.h index dbbf581f97..229d7fadc2 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 -- cgit v1.2.1