Mercurial > cpython-lru_cache-weakref
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 45059:9639a73afa47 | 45060:c05ee77b39f2 |
|---|---|
| 1105 PyDoc_STRVAR(flags__doc__, | 1105 PyDoc_STRVAR(flags__doc__, |
| 1106 "sys.flags\n\ | 1106 "sys.flags\n\ |
| 1107 \n\ | 1107 \n\ |
| 1108 Flags provided through command line arguments or environment vars."); | 1108 Flags provided through command line arguments or environment vars."); |
| 1109 | 1109 |
| 1110 static PyTypeObject FlagsType; | 1110 static PyTypeObject FlagsType = {0, 0, 0, 0, 0, 0}; |
| 1111 | 1111 |
| 1112 static PyStructSequence_Field flags_fields[] = { | 1112 static PyStructSequence_Field flags_fields[] = { |
| 1113 {"debug", "-d"}, | 1113 {"debug", "-d"}, |
| 1114 {"py3k_warning", "-3"}, | 1114 {"py3k_warning", "-3"}, |
| 1115 {"division_warning", "-Q"}, | 1115 {"division_warning", "-Q"}, |
| 1178 #undef SetFlag | 1178 #undef SetFlag |
| 1179 | 1179 |
| 1180 if (PyErr_Occurred()) { | 1180 if (PyErr_Occurred()) { |
| 1181 return NULL; | 1181 return NULL; |
| 1182 } | 1182 } |
| 1183 | |
| 1184 return seq; | 1183 return seq; |
| 1185 } | 1184 } |
| 1186 | 1185 |
| 1187 PyObject * | 1186 PyObject * |
| 1188 _PySys_Init(void) | 1187 _PySys_Init(void) |
| 1344 } | 1343 } |
| 1345 if (warnoptions != NULL) { | 1344 if (warnoptions != NULL) { |
| 1346 PyDict_SetItemString(sysdict, "warnoptions", warnoptions); | 1345 PyDict_SetItemString(sysdict, "warnoptions", warnoptions); |
| 1347 } | 1346 } |
| 1348 | 1347 |
| 1349 PyStructSequence_InitType(&FlagsType, &flags_desc); | 1348 if (FlagsType.tp_name == 0) |
| 1349 PyStructSequence_InitType(&FlagsType, &flags_desc); | |
| 1350 SET_SYS_FROM_STRING("flags", make_flags()); | 1350 SET_SYS_FROM_STRING("flags", make_flags()); |
| 1351 /* prevent user from creating new instances */ | 1351 /* prevent user from creating new instances */ |
| 1352 FlagsType.tp_init = NULL; | 1352 FlagsType.tp_init = NULL; |
| 1353 FlagsType.tp_new = NULL; | 1353 FlagsType.tp_new = NULL; |
| 1354 | 1354 |
