diff --git a/Modules/cPickle.c b/Modules/cPickle.c index 2466465b5f7..5b02c2aa7d7 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -2875,7 +2875,8 @@ Instance_New(PyObject *cls, PyObject *args) { inst->in_class=(PyClassObject*)cls; Py_INCREF(cls); UNLESS (inst->in_dict=PyDict_New()) { - Py_DECREF(inst); + inst = (PyInstanceObject *) PyObject_AS_GC(inst); + PyObject_DEL(inst); goto err; } PyObject_GC_Init(inst);