[Python-checkins] cpython: initialize map/filter/zip in _PyBuiltin_Init rather than the catch-all function

benjamin.peterson python-checkins at python.org
Wed Oct 31 04:44:19 CET 2012


http://hg.python.org/cpython/rev/75fe7f5fda9a
changeset:   80076:75fe7f5fda9a
parent:      80074:aa52d8559ce5
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Oct 30 23:41:54 2012 -0400
summary:
  initialize map/filter/zip in _PyBuiltin_Init rather than the catch-all function

files:
  Objects/object.c     |  9 ---------
  Python/bltinmodule.c |  6 ++++++
  2 files changed, 6 insertions(+), 9 deletions(-)


diff --git a/Objects/object.c b/Objects/object.c
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1708,15 +1708,6 @@
     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");
-
     if (PyType_Ready(&_PyNamespace_Type) < 0)
         Py_FatalError("Can't initialize namespace type");
 
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2405,6 +2405,12 @@
 _PyBuiltin_Init(void)
 {
     PyObject *mod, *dict, *debug;
+
+    if (PyType_Ready(&PyFilter_Type) < 0 ||
+        PyType_Ready(&PyMap_Type) < 0 ||
+        PyType_Ready(&PyZip_Type) < 0)
+        return NULL;
+
     mod = PyModule_Create(&builtinsmodule);
     if (mod == NULL)
         return NULL;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list