From 5196c586bbcde40538868f8aa3a1f54af1027e33 Mon Sep 17 00:00:00 2001
From: Neil Schemenauer <nascheme@enme.ucalgary.ca>
Date: Wed, 4 Oct 2000 16:22:26 +0000
Subject: - Fix a GC bug caused by PyDict_New() failing.

---
 Modules/cPickle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 2466465..5b02c2a 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);
-- 
cgit v0.12

