diff options
Diffstat (limited to 'Include/objimpl.h')
-rw-r--r-- | Include/objimpl.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h index f475ed0..2337d8a 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -138,6 +138,9 @@ _PyObject_INIT(PyObject *op, PyTypeObject *typeobj) { assert(op != NULL); Py_TYPE(op) = typeobj; + if (PyType_GetFlags(typeobj) & Py_TPFLAGS_HEAPTYPE) { + Py_INCREF(typeobj); + } _Py_NewReference(op); return op; } |