Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1351ca6 commit 66a3a7eCopy full SHA for 66a3a7e
1 file changed
Objects/typeobject.c
@@ -2396,6 +2396,8 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
2396
if (res == NULL)
2397
return NULL;
2398
type = &res->ht_type;
2399
+ /* The flags must be initialized early, before the GC traverses us */
2400
+ type->tp_flags = spec->flags | Py_TPFLAGS_HEAPTYPE;
2401
res->ht_name = PyUnicode_FromString(s);
2402
if (!res->ht_name)
2403
goto fail;
@@ -2450,7 +2452,6 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
2450
2452
2451
2453
type->tp_basicsize = spec->basicsize;
2454
type->tp_itemsize = spec->itemsize;
- type->tp_flags = spec->flags | Py_TPFLAGS_HEAPTYPE;
2455
2456
for (slot = spec->slots; slot->slot; slot++) {
2457
if (slot->slot >= Py_ARRAY_LENGTH(slotoffsets)) {
0 commit comments