summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2008-01-24 17:58:05 (GMT)
committerGuido van Rossum <guido@python.org>2008-01-24 17:58:05 (GMT)
commit37edeab77875ef35ea54b92d5ba8a94df7deb3f7 (patch)
tree04730c76af49de3afc7da67fe4b7670aa8e745d6 /Objects
parent4e3f12486fe0e4d6caf3c46e501a15283cf1c95e (diff)
downloadcpython-37edeab77875ef35ea54b92d5ba8a94df7deb3f7.zip
cpython-37edeab77875ef35ea54b92d5ba8a94df7deb3f7.tar.gz
cpython-37edeab77875ef35ea54b92d5ba8a94df7deb3f7.tar.bz2
Fix test67.py from issue #1303614.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index dbe5658..698ba47 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1349,12 +1349,15 @@ PyObject_GenericGetAttr(PyObject *obj, PyObject *name)
dictptr = (PyObject **) ((char *)obj + dictoffset);
dict = *dictptr;
if (dict != NULL) {
+ Py_INCREF(dict);
res = PyDict_GetItem(dict, name);
if (res != NULL) {
Py_INCREF(res);
Py_XDECREF(descr);
+ Py_DECREF(dict);
goto done;
}
+ Py_DECREF(dict);
}
}
@@ -1435,12 +1438,14 @@ PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value)
*dictptr = dict;
}
if (dict != NULL) {
+ Py_INCREF(dict);
if (value == NULL)
res = PyDict_DelItem(dict, name);
else
res = PyDict_SetItem(dict, name, value);
if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError))
PyErr_SetObject(PyExc_AttributeError, name);
+ Py_DECREF(dict);
goto done;
}
}