diff options
author | Guido van Rossum <guido@python.org> | 2008-01-24 17:59:56 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2008-01-24 17:59:56 +0000 |
commit | 1859f5b4d229ed9f79935b13332fcb72e097ea74 (patch) | |
tree | 3468249392a2115b71ee9763f2616747f92f6035 | |
parent | 61c2c9536fdcb29c6224850f8a92e99478d54ff3 (diff) | |
download | cpython-git-1859f5b4d229ed9f79935b13332fcb72e097ea74.tar.gz |
Backport r60246.
Fix issue #1303614, test67.py.
-rw-r--r-- | Objects/object.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c index b0672f30e6..71e5641e96 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1335,12 +1335,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); } } @@ -1421,12 +1424,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; } } |