diff --git a/Include/Python.h b/Include/Python.h index 969ef0f1912..5c6e1f2c225 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -113,6 +113,7 @@ #include "import.h" #include "abstract.h" +#include "bltinmodule.h" #include "compile.h" #include "eval.h" diff --git a/Include/bltinmodule.h b/Include/bltinmodule.h new file mode 100644 index 00000000000..868c9e6443b --- /dev/null +++ b/Include/bltinmodule.h @@ -0,0 +1,14 @@ +#ifndef Py_BLTINMODULE_H +#define Py_BLTINMODULE_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyFilter_Type; +PyAPI_DATA(PyTypeObject) PyMap_Type; +PyAPI_DATA(PyTypeObject) PyZip_Type; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BLTINMODULE_H */ diff --git a/Makefile.pre.in b/Makefile.pre.in index 0a4b35ec284..f46b7ad47f7 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -612,6 +612,7 @@ PYTHON_HEADERS= \ Include/abstract.h \ Include/asdl.h \ Include/ast.h \ + Include/bltinmodule.h \ Include/bitset.h \ Include/boolobject.h \ Include/bytes_methods.h \ diff --git a/Objects/object.c b/Objects/object.c index 9544b9ac087..58b70f09e74 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1595,6 +1595,15 @@ _Py_ReadyTypes(void) if (PyType_Ready(&PyMemberDescr_Type) < 0) Py_FatalError("Can't initialize member descriptor type"); + + if (PyType_Ready(&PyFilter_Type) < 0) + Py_FatalError("Can't initialize filter type"); + + if (PyType_Ready(&PyMap_Type) < 0) + Py_FatalError("Can't initialize map type"); + + if (PyType_Ready(&PyZip_Type) < 0) + Py_FatalError("Can't initialize zip type"); } diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 7a27fba42ec..c33a37ea13b 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -317,8 +317,6 @@ typedef struct { PyObject *it; } filterobject; -PyTypeObject PyFilter_Type; - static PyObject * filter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { @@ -913,8 +911,6 @@ typedef struct { PyObject *func; } mapobject; -PyTypeObject PyMap_Type; - static PyObject * map_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { @@ -2031,8 +2027,6 @@ typedef struct { PyObject *result; } zipobject; -PyTypeObject PyZip_Type; - static PyObject * zip_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {