diff --git a/Include/object.h b/Include/object.h index e5544e8b588..348bf42260a 100644 --- a/Include/object.h +++ b/Include/object.h @@ -83,7 +83,7 @@ typedef struct _typeobject PyTypeObject; #define PyObject_HEAD_INIT(type) \ { _PyObject_EXTRA_INIT \ - 1, type }, + 1, type, NULL }, #define PyVarObject_HEAD_INIT(type, size) \ { PyObject_HEAD_INIT(type) size }, @@ -106,6 +106,7 @@ typedef struct _object { _PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt; PyTypeObject *ob_type; + void *ob_interp; } PyObject; /* Cast argument to PyObject* type. */ diff --git a/Objects/object.c b/Objects/object.c index 124485d64ab..79b713c919d 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -379,6 +379,7 @@ _PyObject_Dump(PyObject* op) } /* first, write fields which are the least likely to crash */ + fprintf(stderr, "object interp : %p\n", op->ob_interp); fprintf(stderr, "object address : %p\n", (void *)op); /* XXX(twouters) cast refcount to long until %zd is universally available */ @@ -1956,6 +1957,7 @@ _Py_NewReference(PyObject *op) #ifdef Py_TRACE_REFS _Py_AddToAllObjects(op, 1); #endif + op->ob_interp = _PyInterpreterState_GET(); }