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

Skip to content

Commit 42124a7

Browse files
committed
initialize map/filter/zip in _PyBuiltin_Init rather than the catch-all function
1 parent 7ff2094 commit 42124a7

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

Objects/object.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,15 +1708,6 @@ _Py_ReadyTypes(void)
17081708
if (PyType_Ready(&PyMemberDescr_Type) < 0)
17091709
Py_FatalError("Can't initialize member descriptor type");
17101710

1711-
if (PyType_Ready(&PyFilter_Type) < 0)
1712-
Py_FatalError("Can't initialize filter type");
1713-
1714-
if (PyType_Ready(&PyMap_Type) < 0)
1715-
Py_FatalError("Can't initialize map type");
1716-
1717-
if (PyType_Ready(&PyZip_Type) < 0)
1718-
Py_FatalError("Can't initialize zip type");
1719-
17201711
if (PyType_Ready(&_PyNamespace_Type) < 0)
17211712
Py_FatalError("Can't initialize namespace type");
17221713

Python/bltinmodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,6 +2405,12 @@ PyObject *
24052405
_PyBuiltin_Init(void)
24062406
{
24072407
PyObject *mod, *dict, *debug;
2408+
2409+
if (PyType_Ready(&PyFilter_Type) < 0 ||
2410+
PyType_Ready(&PyMap_Type) < 0 ||
2411+
PyType_Ready(&PyZip_Type) < 0)
2412+
return NULL;
2413+
24082414
mod = PyModule_Create(&builtinsmodule);
24092415
if (mod == NULL)
24102416
return NULL;

0 commit comments

Comments
 (0)