summaryrefslogtreecommitdiffstats
path: root/Objects/cellobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/cellobject.c')
-rw-r--r--Objects/cellobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/cellobject.c b/Objects/cellobject.c
index 4984366..490afe0 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;
}