Mercurial > cpython-lru_cache-weakref
diff Objects/object.c @ 44915:ebbb7bb0033b legacy-trunk
Fix test67.py from issue #1303614.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 24 Jan 2008 17:58:05 +0000 |
| parents | 387d48c3a0b3 |
| children | 50771a3fad2c |
line wrap: on
line diff
--- a/Objects/object.c Thu Jan 24 15:53:22 2008 +0000 +++ b/Objects/object.c Thu Jan 24 17:58:05 2008 +0000 @@ -1349,12 +1349,15 @@ 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 @@ *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; } }
