Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 45060:c05ee77b39f2 legacy-trunk
The previous change was causing a segfault after multiple calls to Py_Initialize() and Py_Finalize().
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Wed, 30 Jan 2008 18:58:29 +0000 |
| parents | 9639a73afa47 |
| children | 8fdd6d62ea55 |
line wrap: on
line diff
--- a/Python/sysmodule.c Wed Jan 30 17:21:22 2008 +0000 +++ b/Python/sysmodule.c Wed Jan 30 18:58:29 2008 +0000 @@ -1107,7 +1107,7 @@ \n\ Flags provided through command line arguments or environment vars."); -static PyTypeObject FlagsType; +static PyTypeObject FlagsType = {0, 0, 0, 0, 0, 0}; static PyStructSequence_Field flags_fields[] = { {"debug", "-d"}, @@ -1180,7 +1180,6 @@ if (PyErr_Occurred()) { return NULL; } - return seq; } @@ -1346,7 +1345,8 @@ PyDict_SetItemString(sysdict, "warnoptions", warnoptions); } - PyStructSequence_InitType(&FlagsType, &flags_desc); + if (FlagsType.tp_name == 0) + PyStructSequence_InitType(&FlagsType, &flags_desc); SET_SYS_FROM_STRING("flags", make_flags()); /* prevent user from creating new instances */ FlagsType.tp_init = NULL;
