summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-06-28 23:46:07 (GMT)
committerGuido van Rossum <guido@python.org>2000-06-28 23:46:07 (GMT)
commitd7823f264570fb94f179e453330ea12f6158e2e5 (patch)
tree7f6152d0fe44b663513073fce1c60eb3fb3bbeb5 /Objects/classobject.c
parent98626cd7ac22f2a77eaa68bc53e2ac27c67d9fa4 (diff)
downloadcpython-d7823f264570fb94f179e453330ea12f6158e2e5.zip
cpython-d7823f264570fb94f179e453330ea12f6158e2e5.tar.gz
cpython-d7823f264570fb94f179e453330ea12f6158e2e5.tar.bz2
Vladimir Marangozov:
Avoid calling the dealloc function, previously triggered with DECREF(inst). This caused a segfault in PyDict_GetItem, called with a NULL dict, whenever inst->in_dict fails under low-memory conditions.
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 9e1d1b2..cd0bb1d 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -489,13 +489,13 @@ PyInstance_New(class, arg, kw)
inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
if (inst == NULL)
return NULL;
- Py_INCREF(class);
- inst->in_class = (PyClassObject *)class;
inst->in_dict = PyDict_New();
if (inst->in_dict == NULL) {
- Py_DECREF(inst);
+ PyObject_DEL(inst);
return NULL;
}
+ Py_INCREF(class);
+ inst->in_class = (PyClassObject *)class;
if (initstr == NULL)
initstr = PyString_InternFromString("__init__");
init = instance_getattr2(inst, initstr);