Skip to content

Commit 4efde8e

Browse files
author
Stefan Behnel
committed
Change nice interface of "find_name_in_mro()" to evil interface eating lookup exceptions, just like "_PyType_Lookup()" did previously.
1 parent 5184191 commit 4efde8e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Objects/typeobject.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,10 +2993,9 @@ find_name_in_mro(PyTypeObject *type, PyObject *name, int *error)
29932993
res = _PyDict_GetItem_KnownHash(dict, name, hash);
29942994
if (res != NULL)
29952995
break;
2996-
if (PyErr_Occurred()) {
2997-
*error = -1;
2998-
goto done;
2999-
}
2996+
/* _PyType_Lookup() ignored and cleared lookup errors and we keep this
2997+
bad behaviour, instead of returning NULL and setting error = -1. */
2998+
PyErr_Clear();
30002999
}
30013000
*error = 0;
30023001
done:

0 commit comments

Comments
 (0)