[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.237,2.238
Tim Peters
tim_one@users.sourceforge.net
Thu, 13 Sep 2001 14:37:19 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv12526/python/Python
Modified Files:
bltinmodule.c
Log Message:
_PyBuiltin_Init(): For clarity, macroize this purely repetitive code.
Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.237
retrieving revision 2.238
diff -C2 -d -r2.237 -r2.238
*** bltinmodule.c 2001/09/13 05:38:56 2.237
--- bltinmodule.c 2001/09/13 21:37:17 2.238
***************
*** 1838,1893 ****
return NULL;
dict = PyModule_GetDict(mod);
! if (PyDict_SetItemString(dict, "None", Py_None) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "Ellipsis", Py_Ellipsis) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "NotImplemented",
! Py_NotImplemented) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "classmethod",
! (PyObject *) &PyClassMethod_Type) < 0)
! return NULL;
#ifndef WITHOUT_COMPLEX
! if (PyDict_SetItemString(dict, "complex",
! (PyObject *) &PyComplex_Type) < 0)
! return NULL;
#endif
! if (PyDict_SetItemString(dict, "dictionary",
! (PyObject *) &PyDict_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "float",
! (PyObject *) &PyFloat_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "property",
! (PyObject *) &PyProperty_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "int", (PyObject *) &PyInt_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "list", (PyObject *) &PyList_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "long", (PyObject *) &PyLong_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "object",
! (PyObject *) &PyBaseObject_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "staticmethod",
! (PyObject *) &PyStaticMethod_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "str", (PyObject *) &PyString_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "super",
! (PyObject *) &PySuper_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "tuple",
! (PyObject *) &PyTuple_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "type", (PyObject *) &PyType_Type) < 0)
! return NULL;
! if (PyDict_SetItemString(dict, "file", (PyObject *) &PyFile_Type) < 0)
! return NULL;
#ifdef Py_USING_UNICODE
! if (PyDict_SetItemString(dict, "unicode",
! (PyObject *) &PyUnicode_Type) < 0)
! return NULL;
#endif
debug = PyInt_FromLong(Py_OptimizeFlag == 0);
--- 1838,1868 ----
return NULL;
dict = PyModule_GetDict(mod);
!
! #define SETBUILTIN(NAME, OBJECT) \
! if (PyDict_SetItemString(dict, NAME, (PyObject *)OBJECT) < 0) \
! return NULL
!
! SETBUILTIN("None", Py_None);
! SETBUILTIN("Ellipsis", Py_Ellipsis);
! SETBUILTIN("NotImplemented", Py_NotImplemented);
! SETBUILTIN("classmethod", &PyClassMethod_Type);
#ifndef WITHOUT_COMPLEX
! SETBUILTIN("complex", &PyComplex_Type);
#endif
! SETBUILTIN("dictionary", &PyDict_Type);
! SETBUILTIN("float", &PyFloat_Type);
! SETBUILTIN("property", &PyProperty_Type);
! SETBUILTIN("int", &PyInt_Type);
! SETBUILTIN("list", &PyList_Type);
! SETBUILTIN("long", &PyLong_Type);
! SETBUILTIN("object", &PyBaseObject_Type);
! SETBUILTIN("staticmethod", &PyStaticMethod_Type);
! SETBUILTIN("str", &PyString_Type);
! SETBUILTIN("super", &PySuper_Type);
! SETBUILTIN("tuple", &PyTuple_Type);
! SETBUILTIN("type", &PyType_Type);
! SETBUILTIN("file", &PyFile_Type);
#ifdef Py_USING_UNICODE
! SETBUILTIN("unicode", &PyUnicode_Type);
#endif
debug = PyInt_FromLong(Py_OptimizeFlag == 0);
***************
*** 1899,1902 ****
--- 1874,1878 ----
return mod;
+ #undef SETBUILTIN
}