diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-15 12:45:05 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-15 12:45:05 (GMT) |
commit | c597d1b4468e98f9f1f3fe22ab97012e4be918dc (patch) | |
tree | a6e3afdfd586d9e5215f3d40116586e6046296c8 /Objects/structseq.c | |
parent | 4b501e6c7dd65ecb4a469a0fbc8a8fc8d62a7922 (diff) | |
download | cpython-c597d1b4468e98f9f1f3fe22ab97012e4be918dc.zip cpython-c597d1b4468e98f9f1f3fe22ab97012e4be918dc.tar.gz cpython-c597d1b4468e98f9f1f3fe22ab97012e4be918dc.tar.bz2 |
Unlink the structseq type from the global list of
objects before initializing it. It might be linked
already if there was a Py_Initialize/Py_Finalize
cycle earlier; not unlinking it would break the global
list.
Diffstat (limited to 'Objects/structseq.c')
-rw-r--r-- | Objects/structseq.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/structseq.c b/Objects/structseq.c index e1e7cfa..e074810 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -349,6 +349,14 @@ PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc) PyMemberDef* members; int n_members, n_unnamed_members, i, k; +#ifdef Py_TRACE_REFS + /* if the type object was chained, unchain it first + before overwriting its storage */ + if (type->_ob_next) { + _Py_ForgetReference((PyObject*)type); + } +#endif + n_unnamed_members = 0; for (i = 0; desc->fields[i].name != NULL; ++i) if (desc->fields[i].name == PyStructSequence_UnnamedField) |