summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-02-16 20:55:24 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-02-16 20:55:24 (GMT)
commit632fad393304db484f508d1833a9fda52b7f193a (patch)
tree47332f046dac89a7d67b08d414154015233eeb38 /Objects
parent588ff93f1383436694e26c962528291913012296 (diff)
downloadcpython-632fad393304db484f508d1833a9fda52b7f193a.zip
cpython-632fad393304db484f508d1833a9fda52b7f193a.tar.gz
cpython-632fad393304db484f508d1833a9fda52b7f193a.tar.bz2
Prevent a crash with nested scopes, again caused by calling Py_DECREF when the pointer
is still present in the containing structure.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/cellobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/cellobject.c b/Objects/cellobject.c
index dc684d5..b72d43b 100644
--- a/Objects/cellobject.c
+++ b/Objects/cellobject.c
@@ -31,13 +31,15 @@ PyCell_Get(PyObject *op)
int
PyCell_Set(PyObject *op, PyObject *obj)
{
+ PyObject* oldobj;
if (!PyCell_Check(op)) {
PyErr_BadInternalCall();
return -1;
}
- Py_XDECREF(((PyCellObject*)op)->ob_ref);
+ oldobj = PyCell_GET(op);
Py_XINCREF(obj);
PyCell_SET(op, obj);
+ Py_XDECREF(oldobj);
return 0;
}