mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fix test67.py from issue #1303614.
This commit is contained in:
parent
4e3f12486f
commit
37edeab778
3 changed files with 29 additions and 21 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue