Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bc5b68

Browse files
committed
these builtins have to be initialized
1 parent c3491d3 commit 8bc5b68

5 files changed

Lines changed: 25 additions & 6 deletions

File tree

Include/Python.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
#include "import.h"
114114

115115
#include "abstract.h"
116+
#include "bltinmodule.h"
116117

117118
#include "compile.h"
118119
#include "eval.h"

Include/bltinmodule.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef Py_BLTINMODULE_H
2+
#define Py_BLTINMODULE_H
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
PyAPI_DATA(PyTypeObject) PyFilter_Type;
8+
PyAPI_DATA(PyTypeObject) PyMap_Type;
9+
PyAPI_DATA(PyTypeObject) PyZip_Type;
10+
11+
#ifdef __cplusplus
12+
}
13+
#endif
14+
#endif /* !Py_BLTINMODULE_H */

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ PYTHON_HEADERS= \
612612
Include/abstract.h \
613613
Include/asdl.h \
614614
Include/ast.h \
615+
Include/bltinmodule.h \
615616
Include/bitset.h \
616617
Include/boolobject.h \
617618
Include/bytes_methods.h \

Objects/object.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,15 @@ _Py_ReadyTypes(void)
15951595

15961596
if (PyType_Ready(&PyMemberDescr_Type) < 0)
15971597
Py_FatalError("Can't initialize member descriptor type");
1598+
1599+
if (PyType_Ready(&PyFilter_Type) < 0)
1600+
Py_FatalError("Can't initialize filter type");
1601+
1602+
if (PyType_Ready(&PyMap_Type) < 0)
1603+
Py_FatalError("Can't initialize map type");
1604+
1605+
if (PyType_Ready(&PyZip_Type) < 0)
1606+
Py_FatalError("Can't initialize zip type");
15981607
}
15991608

16001609

Python/bltinmodule.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,6 @@ typedef struct {
317317
PyObject *it;
318318
} filterobject;
319319

320-
PyTypeObject PyFilter_Type;
321-
322320
static PyObject *
323321
filter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
324322
{
@@ -913,8 +911,6 @@ typedef struct {
913911
PyObject *func;
914912
} mapobject;
915913

916-
PyTypeObject PyMap_Type;
917-
918914
static PyObject *
919915
map_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
920916
{
@@ -2031,8 +2027,6 @@ typedef struct {
20312027
PyObject *result;
20322028
} zipobject;
20332029

2034-
PyTypeObject PyZip_Type;
2035-
20362030
static PyObject *
20372031
zip_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
20382032
{

0 commit comments

Comments
 (0)