summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-30 18:58:29 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-30 18:58:29 (GMT)
commit796fc3158572c9a20f64f6b1c54e278639e6f032 (patch)
tree2872734741608db7bb5c5c2038eb50a0a4e99d0c /Python/sysmodule.c
parent0d9244332b4c9dad8722f7ed651fb922de93afe6 (diff)
downloadcpython-796fc3158572c9a20f64f6b1c54e278639e6f032.zip
cpython-796fc3158572c9a20f64f6b1c54e278639e6f032.tar.gz
cpython-796fc3158572c9a20f64f6b1c54e278639e6f032.tar.bz2
The previous change was causing a segfault after multiple calls to Py_Initialize() and Py_Finalize().
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 80d24d1..41830b9 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1107,7 +1107,7 @@ PyDoc_STRVAR(flags__doc__,
\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 @@ make_flags(void)
if (PyErr_Occurred()) {
return NULL;
}
-
return seq;
}
@@ -1346,7 +1345,8 @@ _PySys_Init(void)
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;