diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-28 15:23:28 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-28 15:23:28 +0100 |
commit | e19b28f2bd89c047b12f6a8ffb1fe793834700d3 (patch) | |
tree | 8261b98b29eedb8ce67df4d571e8ba9b948d17ab /Objects/object.c | |
parent | f7868847da9f84cb68605b4b94d8fcc205e0766e (diff) | |
parent | 3eca28c61363a03b81b9fb12775490d6e42d8ecf (diff) | |
download | cpython-git-e19b28f2bd89c047b12f6a8ffb1fe793834700d3.tar.gz |
Merge branch 'master' into bind-socket
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Objects/object.c b/Objects/object.c index cf5264b5d8..bd44acacb6 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -5,6 +5,7 @@ #include "pycore_pystate.h" #include "pycore_context.h" #include "frameobject.h" +#include "interpreteridobject.h" #ifdef __cplusplus extern "C" { @@ -229,6 +230,9 @@ PyObject_Init(PyObject *op, PyTypeObject *tp) return PyErr_NoMemory(); /* Any changes should be reflected in PyObject_INIT (objimpl.h) */ Py_TYPE(op) = tp; + if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) { + Py_INCREF(tp); + } _Py_NewReference(op); return op; } @@ -239,9 +243,8 @@ PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, Py_ssize_t size) if (op == NULL) return (PyVarObject *) PyErr_NoMemory(); /* Any changes should be reflected in PyObject_INIT_VAR */ - op->ob_size = size; - Py_TYPE(op) = tp; - _Py_NewReference((PyObject *)op); + Py_SIZE(op) = size; + PyObject_Init((PyObject *)op, tp); return op; } @@ -1806,6 +1809,7 @@ _PyTypes_Init(void) INIT_TYPE(&PySeqIter_Type, "sequence iterator"); INIT_TYPE(&PyCoro_Type, "coroutine"); INIT_TYPE(&_PyCoroWrapper_Type, "coroutine wrapper"); + INIT_TYPE(&_PyInterpreterID_Type, "interpreter ID"); return _Py_INIT_OK(); #undef INIT_TYPE |