Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 5039:38032267968c legacy-trunk
Initialize the ob_type field of PyAST_Type dynamically (in
initparser()) instead of statically (in the initializer). The static
initialization, using the address of an object in a different DLL, is
too much for the Microsoft VC++ compiler, and we want to be able to
build this module as a separate DLL (it's nice to have but we don't
want to increase the core DLL's size by 25K). This same trick has
been applied to a number of modules, e.g. NumPy and _tkinter.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 23 Jan 1997 23:29:44 +0000 |
| parents | d36250aefb82 |
| children | b4e671bc1331 |
line wrap: on
line diff
--- a/Modules/parsermodule.c Thu Jan 23 19:39:29 1997 +0000 +++ b/Modules/parsermodule.c Thu Jan 23 23:29:44 1997 +0000 @@ -197,7 +197,7 @@ /* static */ PyTypeObject PyAST_Type = { - PyObject_HEAD_INIT(&PyType_Type) + PyObject_HEAD_INIT(NULL) 0, "ast", /* tp_name */ sizeof(PyAST_Object), /* tp_basicsize */ @@ -2593,8 +2593,12 @@ void initparser() { - PyObject* module = Py_InitModule("parser", parser_functions); - PyObject* dict = PyModule_GetDict(module); + PyObject* module; + PyObject* dict; + + PyAST_Type.ob_type = &PyType_Type; + module = Py_InitModule("parser", parser_functions); + dict = PyModule_GetDict(module); parser_error = PyString_FromString("parser.ParserError");
