diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-30 18:58:29 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-30 18:58:29 (GMT) |
commit | 796fc3158572c9a20f64f6b1c54e278639e6f032 (patch) | |
tree | 2872734741608db7bb5c5c2038eb50a0a4e99d0c /Objects | |
parent | 0d9244332b4c9dad8722f7ed651fb922de93afe6 (diff) | |
download | cpython-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 'Objects')
-rw-r--r-- | Objects/floatobject.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 689edcd..6351278 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -66,7 +66,7 @@ PyFloat_GetMin(void) return DBL_MIN; } -static PyTypeObject FloatInfoType = {0}; +static PyTypeObject FloatInfoType = {0, 0, 0, 0, 0, 0}; PyDoc_STRVAR(floatinfo__doc__, "sys.floatinfo\n\ @@ -105,15 +105,9 @@ static PyStructSequence_Desc floatinfo_desc = { PyObject * PyFloat_GetInfo(void) { - static PyObject* floatinfo; + PyObject* floatinfo; int pos = 0; - if (floatinfo != NULL) { - Py_INCREF(floatinfo); - return floatinfo; - } - PyStructSequence_InitType(&FloatInfoType, &floatinfo_desc); - floatinfo = PyStructSequence_New(&FloatInfoType); if (floatinfo == NULL) { return NULL; @@ -142,7 +136,6 @@ PyFloat_GetInfo(void) Py_CLEAR(floatinfo); return NULL; } - return floatinfo; } @@ -1669,6 +1662,9 @@ _PyFloat_Init(void) /* Initialize floating point repr */ _PyFloat_DigitsInit(); #endif + /* Init float info */ + if (FloatInfoType.tp_name == 0) + PyStructSequence_InitType(&FloatInfoType, &floatinfo_desc); } void |