summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 2240f78..7ae50c4 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4505,7 +4505,15 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_DECREF(joined);
return NULL;
}
- return type->tp_alloc(type, 0);
+ PyObject *obj = type->tp_alloc(type, 0);
+ if (obj == NULL) {
+ return NULL;
+ }
+ if (_PyObject_InitializeDict(obj)) {
+ Py_DECREF(obj);
+ return NULL;
+ }
+ return obj;
}
static void