mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)
This commit is contained in:
parent
a180b007d9
commit
a24107b04c
31 changed files with 538 additions and 242 deletions
|
@ -491,9 +491,11 @@ type_module(PyTypeObject *type, void *context)
|
|||
PyObject *mod;
|
||||
|
||||
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
||||
mod = _PyDict_GetItemId(type->tp_dict, &PyId___module__);
|
||||
mod = _PyDict_GetItemIdWithError(type->tp_dict, &PyId___module__);
|
||||
if (mod == NULL) {
|
||||
PyErr_Format(PyExc_AttributeError, "__module__");
|
||||
if (!PyErr_Occurred()) {
|
||||
PyErr_Format(PyExc_AttributeError, "__module__");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(mod);
|
||||
|
@ -532,11 +534,13 @@ type_abstractmethods(PyTypeObject *type, void *context)
|
|||
/* type itself has an __abstractmethods__ descriptor (this). Don't return
|
||||
that. */
|
||||
if (type != &PyType_Type)
|
||||
mod = _PyDict_GetItemId(type->tp_dict, &PyId___abstractmethods__);
|
||||
mod = _PyDict_GetItemIdWithError(type->tp_dict, &PyId___abstractmethods__);
|
||||
if (!mod) {
|
||||
PyObject *message = _PyUnicode_FromId(&PyId___abstractmethods__);
|
||||
if (message)
|
||||
PyErr_SetObject(PyExc_AttributeError, message);
|
||||
if (!PyErr_Occurred()) {
|
||||
PyObject *message = _PyUnicode_FromId(&PyId___abstractmethods__);
|
||||
if (message)
|
||||
PyErr_SetObject(PyExc_AttributeError, message);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(mod);
|
||||
|
@ -808,10 +812,12 @@ type_get_doc(PyTypeObject *type, void *context)
|
|||
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) {
|
||||
return _PyType_GetDocFromInternalDoc(type->tp_name, type->tp_doc);
|
||||
}
|
||||
result = _PyDict_GetItemId(type->tp_dict, &PyId___doc__);
|
||||
result = _PyDict_GetItemIdWithError(type->tp_dict, &PyId___doc__);
|
||||
if (result == NULL) {
|
||||
result = Py_None;
|
||||
Py_INCREF(result);
|
||||
if (!PyErr_Occurred()) {
|
||||
result = Py_None;
|
||||
Py_INCREF(result);
|
||||
}
|
||||
}
|
||||
else if (Py_TYPE(result)->tp_descr_get) {
|
||||
result = Py_TYPE(result)->tp_descr_get(result, NULL,
|
||||
|
@ -2452,13 +2458,16 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
goto error;
|
||||
|
||||
/* Check for a __slots__ sequence variable in dict, and count it */
|
||||
slots = _PyDict_GetItemId(dict, &PyId___slots__);
|
||||
slots = _PyDict_GetItemIdWithError(dict, &PyId___slots__);
|
||||
nslots = 0;
|
||||
add_dict = 0;
|
||||
add_weak = 0;
|
||||
may_add_dict = base->tp_dictoffset == 0;
|
||||
may_add_weak = base->tp_weaklistoffset == 0 && base->tp_itemsize == 0;
|
||||
if (slots == NULL) {
|
||||
if (PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
if (may_add_dict) {
|
||||
add_dict++;
|
||||
}
|
||||
|
@ -2535,7 +2544,7 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
goto error;
|
||||
}
|
||||
PyList_SET_ITEM(newslots, j, tmp);
|
||||
if (PyDict_GetItem(dict, tmp)) {
|
||||
if (PyDict_GetItemWithError(dict, tmp)) {
|
||||
/* CPython inserts __qualname__ and __classcell__ (when needed)
|
||||
into the namespace when creating a class. They will be deleted
|
||||
below so won't act as class variables. */
|
||||
|
@ -2548,6 +2557,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
goto error;
|
||||
}
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
Py_DECREF(newslots);
|
||||
goto error;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
assert(j == nslots - add_dict - add_weak);
|
||||
|
@ -2632,22 +2645,28 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
type->tp_dict = dict;
|
||||
|
||||
/* Set __module__ in the dict */
|
||||
if (_PyDict_GetItemId(dict, &PyId___module__) == NULL) {
|
||||
if (_PyDict_GetItemIdWithError(dict, &PyId___module__) == NULL) {
|
||||
if (PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
tmp = PyEval_GetGlobals();
|
||||
if (tmp != NULL) {
|
||||
tmp = _PyDict_GetItemId(tmp, &PyId___name__);
|
||||
tmp = _PyDict_GetItemIdWithError(tmp, &PyId___name__);
|
||||
if (tmp != NULL) {
|
||||
if (_PyDict_SetItemId(dict, &PyId___module__,
|
||||
tmp) < 0)
|
||||
goto error;
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set ht_qualname to dict['__qualname__'] if available, else to
|
||||
__name__. The __qualname__ accessor will look for ht_qualname.
|
||||
*/
|
||||
qualname = _PyDict_GetItemId(dict, &PyId___qualname__);
|
||||
qualname = _PyDict_GetItemIdWithError(dict, &PyId___qualname__);
|
||||
if (qualname != NULL) {
|
||||
if (!PyUnicode_Check(qualname)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
|
@ -2656,6 +2675,9 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
goto error;
|
||||
}
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
et->ht_qualname = qualname ? qualname : et->ht_name;
|
||||
Py_INCREF(et->ht_qualname);
|
||||
if (qualname != NULL && _PyDict_DelItemId(dict, &PyId___qualname__) < 0)
|
||||
|
@ -2666,7 +2688,7 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
if that fails, it will still look into __dict__.
|
||||
*/
|
||||
{
|
||||
PyObject *doc = _PyDict_GetItemId(dict, &PyId___doc__);
|
||||
PyObject *doc = _PyDict_GetItemIdWithError(dict, &PyId___doc__);
|
||||
if (doc != NULL && PyUnicode_Check(doc)) {
|
||||
Py_ssize_t len;
|
||||
const char *doc_str;
|
||||
|
@ -2685,11 +2707,14 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
memcpy(tp_doc, doc_str, len + 1);
|
||||
type->tp_doc = tp_doc;
|
||||
}
|
||||
else if (doc == NULL && PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Special-case __new__: if it's a plain function,
|
||||
make it a static function */
|
||||
tmp = _PyDict_GetItemId(dict, &PyId___new__);
|
||||
tmp = _PyDict_GetItemIdWithError(dict, &PyId___new__);
|
||||
if (tmp != NULL && PyFunction_Check(tmp)) {
|
||||
tmp = PyStaticMethod_New(tmp);
|
||||
if (tmp == NULL)
|
||||
|
@ -2700,10 +2725,13 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
Py_DECREF(tmp);
|
||||
}
|
||||
else if (tmp == NULL && PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Special-case __init_subclass__ and __class_getitem__:
|
||||
if they are plain functions, make them classmethods */
|
||||
tmp = _PyDict_GetItemId(dict, &PyId___init_subclass__);
|
||||
tmp = _PyDict_GetItemIdWithError(dict, &PyId___init_subclass__);
|
||||
if (tmp != NULL && PyFunction_Check(tmp)) {
|
||||
tmp = PyClassMethod_New(tmp);
|
||||
if (tmp == NULL)
|
||||
|
@ -2714,8 +2742,11 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
Py_DECREF(tmp);
|
||||
}
|
||||
else if (tmp == NULL && PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
tmp = _PyDict_GetItemId(dict, &PyId___class_getitem__);
|
||||
tmp = _PyDict_GetItemIdWithError(dict, &PyId___class_getitem__);
|
||||
if (tmp != NULL && PyFunction_Check(tmp)) {
|
||||
tmp = PyClassMethod_New(tmp);
|
||||
if (tmp == NULL)
|
||||
|
@ -2726,6 +2757,9 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
Py_DECREF(tmp);
|
||||
}
|
||||
else if (tmp == NULL && PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Add descriptors for custom slots from __slots__, or for __dict__ */
|
||||
mp = PyHeapType_GET_MEMBERS(et);
|
||||
|
@ -2797,7 +2831,7 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
type->tp_free = PyObject_Del;
|
||||
|
||||
/* store type in class' cell if one is supplied */
|
||||
cell = _PyDict_GetItemId(dict, &PyId___classcell__);
|
||||
cell = _PyDict_GetItemIdWithError(dict, &PyId___classcell__);
|
||||
if (cell != NULL) {
|
||||
/* At least one method requires a reference to its defining class */
|
||||
if (!PyCell_Check(cell)) {
|
||||
|
@ -2807,8 +2841,12 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
goto error;
|
||||
}
|
||||
PyCell_Set(cell, (PyObject *) type);
|
||||
_PyDict_DelItemId(dict, &PyId___classcell__);
|
||||
PyErr_Clear();
|
||||
if (_PyDict_DelItemId(dict, &PyId___classcell__) < 0) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Initialize the rest */
|
||||
|
@ -3741,47 +3779,41 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
|
||||
if (type->tp_flags & Py_TPFLAGS_IS_ABSTRACT) {
|
||||
PyObject *abstract_methods = NULL;
|
||||
PyObject *builtins;
|
||||
PyObject *sorted;
|
||||
PyObject *sorted_methods = NULL;
|
||||
PyObject *joined = NULL;
|
||||
PyObject *abstract_methods;
|
||||
PyObject *sorted_methods;
|
||||
PyObject *joined;
|
||||
PyObject *comma;
|
||||
_Py_static_string(comma_id, ", ");
|
||||
_Py_IDENTIFIER(sorted);
|
||||
|
||||
/* Compute ", ".join(sorted(type.__abstractmethods__))
|
||||
into joined. */
|
||||
abstract_methods = type_abstractmethods(type, NULL);
|
||||
if (abstract_methods == NULL)
|
||||
goto error;
|
||||
builtins = PyEval_GetBuiltins();
|
||||
if (builtins == NULL)
|
||||
goto error;
|
||||
sorted = _PyDict_GetItemId(builtins, &PyId_sorted);
|
||||
if (sorted == NULL)
|
||||
goto error;
|
||||
sorted_methods = PyObject_CallFunctionObjArgs(sorted,
|
||||
abstract_methods,
|
||||
NULL);
|
||||
return NULL;
|
||||
sorted_methods = PySequence_List(abstract_methods);
|
||||
Py_DECREF(abstract_methods);
|
||||
if (sorted_methods == NULL)
|
||||
goto error;
|
||||
return NULL;
|
||||
if (PyList_Sort(sorted_methods)) {
|
||||
Py_DECREF(sorted_methods);
|
||||
return NULL;
|
||||
}
|
||||
comma = _PyUnicode_FromId(&comma_id);
|
||||
if (comma == NULL)
|
||||
goto error;
|
||||
if (comma == NULL) {
|
||||
Py_DECREF(sorted_methods);
|
||||
return NULL;
|
||||
}
|
||||
joined = PyUnicode_Join(comma, sorted_methods);
|
||||
Py_DECREF(sorted_methods);
|
||||
if (joined == NULL)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"Can't instantiate abstract class %s "
|
||||
"with abstract methods %U",
|
||||
type->tp_name,
|
||||
joined);
|
||||
error:
|
||||
Py_XDECREF(joined);
|
||||
Py_XDECREF(sorted_methods);
|
||||
Py_XDECREF(abstract_methods);
|
||||
Py_DECREF(joined);
|
||||
return NULL;
|
||||
}
|
||||
return type->tp_alloc(type, 0);
|
||||
|
@ -4610,14 +4642,12 @@ object___reduce_ex___impl(PyObject *self, int protocol)
|
|||
if (objreduce == NULL) {
|
||||
objreduce = _PyDict_GetItemId(PyBaseObject_Type.tp_dict,
|
||||
&PyId___reduce__);
|
||||
if (objreduce == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
reduce = _PyObject_GetAttrId(self, &PyId___reduce__);
|
||||
if (reduce == NULL)
|
||||
PyErr_Clear();
|
||||
else {
|
||||
if (_PyObject_LookupAttrId(self, &PyId___reduce__, &reduce) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (reduce != NULL) {
|
||||
PyObject *cls, *clsreduce;
|
||||
int override;
|
||||
|
||||
|
@ -4829,14 +4859,12 @@ static int
|
|||
add_methods(PyTypeObject *type, PyMethodDef *meth)
|
||||
{
|
||||
PyObject *dict = type->tp_dict;
|
||||
PyObject *name;
|
||||
|
||||
for (; meth->ml_name != NULL; meth++) {
|
||||
PyObject *descr;
|
||||
int err;
|
||||
int isdescr = 1;
|
||||
if (PyDict_GetItemString(dict, meth->ml_name) &&
|
||||
!(meth->ml_flags & METH_COEXIST))
|
||||
continue;
|
||||
if (meth->ml_flags & METH_CLASS) {
|
||||
if (meth->ml_flags & METH_STATIC) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
|
@ -4846,7 +4874,7 @@ add_methods(PyTypeObject *type, PyMethodDef *meth)
|
|||
descr = PyDescr_NewClassMethod(type, meth);
|
||||
}
|
||||
else if (meth->ml_flags & METH_STATIC) {
|
||||
PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, NULL);
|
||||
PyObject *cfunc = PyCFunction_NewEx(meth, (PyObject*)type, NULL);
|
||||
if (cfunc == NULL)
|
||||
return -1;
|
||||
descr = PyStaticMethod_New(cfunc);
|
||||
|
@ -4858,11 +4886,36 @@ add_methods(PyTypeObject *type, PyMethodDef *meth)
|
|||
}
|
||||
if (descr == NULL)
|
||||
return -1;
|
||||
|
||||
if (isdescr) {
|
||||
err = PyDict_SetItem(dict, PyDescr_NAME(descr), descr);
|
||||
name = PyDescr_NAME(descr);
|
||||
}
|
||||
else {
|
||||
err = PyDict_SetItemString(dict, meth->ml_name, descr);
|
||||
name = PyUnicode_FromString(meth->ml_name);
|
||||
if (name == NULL) {
|
||||
Py_DECREF(descr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(meth->ml_flags & METH_COEXIST)) {
|
||||
if (PyDict_GetItemWithError(dict, name)) {
|
||||
if (!isdescr) {
|
||||
Py_DECREF(name);
|
||||
}
|
||||
Py_DECREF(descr);
|
||||
continue;
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
if (!isdescr) {
|
||||
Py_DECREF(name);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
err = PyDict_SetItem(dict, name, descr);
|
||||
if (!isdescr) {
|
||||
Py_DECREF(name);
|
||||
}
|
||||
Py_DECREF(descr);
|
||||
if (err < 0)
|
||||
|
@ -4877,12 +4930,18 @@ add_members(PyTypeObject *type, PyMemberDef *memb)
|
|||
PyObject *dict = type->tp_dict;
|
||||
|
||||
for (; memb->name != NULL; memb++) {
|
||||
PyObject *descr;
|
||||
if (PyDict_GetItemString(dict, memb->name))
|
||||
continue;
|
||||
descr = PyDescr_NewMember(type, memb);
|
||||
PyObject *descr = PyDescr_NewMember(type, memb);
|
||||
if (descr == NULL)
|
||||
return -1;
|
||||
|
||||
if (PyDict_GetItemWithError(dict, PyDescr_NAME(descr))) {
|
||||
Py_DECREF(descr);
|
||||
continue;
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
Py_DECREF(descr);
|
||||
return -1;
|
||||
}
|
||||
if (PyDict_SetItem(dict, PyDescr_NAME(descr), descr) < 0) {
|
||||
Py_DECREF(descr);
|
||||
return -1;
|
||||
|
@ -4898,13 +4957,17 @@ add_getset(PyTypeObject *type, PyGetSetDef *gsp)
|
|||
PyObject *dict = type->tp_dict;
|
||||
|
||||
for (; gsp->name != NULL; gsp++) {
|
||||
PyObject *descr;
|
||||
if (PyDict_GetItemString(dict, gsp->name))
|
||||
continue;
|
||||
descr = PyDescr_NewGetSet(type, gsp);
|
||||
|
||||
PyObject *descr = PyDescr_NewGetSet(type, gsp);
|
||||
if (descr == NULL)
|
||||
return -1;
|
||||
|
||||
if (PyDict_GetItemWithError(dict, PyDescr_NAME(descr))) {
|
||||
continue;
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
Py_DECREF(descr);
|
||||
return -1;
|
||||
}
|
||||
if (PyDict_SetItem(dict, PyDescr_NAME(descr), descr) < 0) {
|
||||
Py_DECREF(descr);
|
||||
return -1;
|
||||
|
@ -5309,7 +5372,10 @@ PyType_Ready(PyTypeObject *type)
|
|||
/* if the type dictionary doesn't contain a __doc__, set it from
|
||||
the tp_doc slot.
|
||||
*/
|
||||
if (_PyDict_GetItemId(type->tp_dict, &PyId___doc__) == NULL) {
|
||||
if (_PyDict_GetItemIdWithError(type->tp_dict, &PyId___doc__) == NULL) {
|
||||
if (PyErr_Occurred()) {
|
||||
goto error;
|
||||
}
|
||||
if (type->tp_doc != NULL) {
|
||||
const char *old_doc = _PyType_DocWithoutSignature(type->tp_name,
|
||||
type->tp_doc);
|
||||
|
@ -5335,9 +5401,12 @@ PyType_Ready(PyTypeObject *type)
|
|||
This signals that __hash__ is not inherited.
|
||||
*/
|
||||
if (type->tp_hash == NULL) {
|
||||
if (_PyDict_GetItemId(type->tp_dict, &PyId___hash__) == NULL) {
|
||||
if (_PyDict_SetItemId(type->tp_dict, &PyId___hash__, Py_None) < 0)
|
||||
if (_PyDict_GetItemIdWithError(type->tp_dict, &PyId___hash__) == NULL) {
|
||||
if (PyErr_Occurred() ||
|
||||
_PyDict_SetItemId(type->tp_dict, &PyId___hash__, Py_None) < 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
type->tp_hash = PyObject_HashNotImplemented;
|
||||
}
|
||||
}
|
||||
|
@ -5988,8 +6057,10 @@ add_tp_new_wrapper(PyTypeObject *type)
|
|||
{
|
||||
PyObject *func;
|
||||
|
||||
if (_PyDict_GetItemId(type->tp_dict, &PyId___new__) != NULL)
|
||||
if (_PyDict_GetItemIdWithError(type->tp_dict, &PyId___new__) != NULL)
|
||||
return 0;
|
||||
if (PyErr_Occurred())
|
||||
return -1;
|
||||
func = PyCFunction_NewEx(tp_new_methoddef, (PyObject *)type, NULL);
|
||||
if (func == NULL)
|
||||
return -1;
|
||||
|
@ -7414,9 +7485,14 @@ recurse_down_subclasses(PyTypeObject *type, PyObject *name,
|
|||
assert(PyType_Check(subclass));
|
||||
/* Avoid recursing down into unaffected classes */
|
||||
dict = subclass->tp_dict;
|
||||
if (dict != NULL && PyDict_Check(dict) &&
|
||||
PyDict_GetItem(dict, name) != NULL)
|
||||
continue;
|
||||
if (dict != NULL && PyDict_Check(dict)) {
|
||||
if (PyDict_GetItemWithError(dict, name) != NULL) {
|
||||
continue;
|
||||
}
|
||||
if (PyErr_Occurred()) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (update_subclasses(subclass, name, callback, data) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
@ -7468,8 +7544,11 @@ add_operators(PyTypeObject *type)
|
|||
ptr = slotptr(type, p->offset);
|
||||
if (!ptr || !*ptr)
|
||||
continue;
|
||||
if (PyDict_GetItem(dict, p->name_strobj))
|
||||
if (PyDict_GetItemWithError(dict, p->name_strobj))
|
||||
continue;
|
||||
if (PyErr_Occurred()) {
|
||||
return -1;
|
||||
}
|
||||
if (*ptr == (void *)PyObject_HashNotImplemented) {
|
||||
/* Classes may prevent the inheritance of the tp_hash
|
||||
slot by storing PyObject_HashNotImplemented in it. Make it
|
||||
|
@ -7579,7 +7658,7 @@ super_getattro(PyObject *self, PyObject *name)
|
|||
goto skip;
|
||||
|
||||
/* keep a strong reference to mro because starttype->tp_mro can be
|
||||
replaced during PyDict_GetItem(dict, name) */
|
||||
replaced during PyDict_GetItemWithError(dict, name) */
|
||||
Py_INCREF(mro);
|
||||
do {
|
||||
PyObject *res, *tmp, *dict;
|
||||
|
@ -7591,7 +7670,7 @@ super_getattro(PyObject *self, PyObject *name)
|
|||
dict = ((PyTypeObject *)tmp)->tp_dict;
|
||||
assert(dict != NULL && PyDict_Check(dict));
|
||||
|
||||
res = PyDict_GetItem(dict, name);
|
||||
res = PyDict_GetItemWithError(dict, name);
|
||||
if (res != NULL) {
|
||||
Py_INCREF(res);
|
||||
|
||||
|
@ -7609,6 +7688,9 @@ super_getattro(PyObject *self, PyObject *name)
|
|||
Py_DECREF(mro);
|
||||
return res;
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i++;
|
||||
} while (i < n);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue