mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
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.
This commit is contained in:
parent
4b501e6c7d
commit
c597d1b446
1 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue