mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
gh-102213: Revert "gh-102213: Optimize the performance of __getattr__
(GH-102248)" (GH-103332)
This reverts commit aa0a73d1bc
.
This commit is contained in:
parent
efb0a2cf3a
commit
059bb04245
3 changed files with 3 additions and 13 deletions
|
@ -8274,17 +8274,14 @@ _Py_slot_tp_getattr_hook(PyObject *self, PyObject *name)
|
|||
(Py_IS_TYPE(getattribute, &PyWrapperDescr_Type) &&
|
||||
((PyWrapperDescrObject *)getattribute)->d_wrapped ==
|
||||
(void *)PyObject_GenericGetAttr))
|
||||
/* finding nothing is reasonable when __getattr__ is defined */
|
||||
res = _PyObject_GenericTryGetAttr(self, name);
|
||||
res = PyObject_GenericGetAttr(self, name);
|
||||
else {
|
||||
Py_INCREF(getattribute);
|
||||
res = call_attribute(self, getattribute, name);
|
||||
Py_DECREF(getattribute);
|
||||
}
|
||||
if (res == NULL) {
|
||||
if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
||||
PyErr_Clear();
|
||||
res = call_attribute(self, getattr, name);
|
||||
}
|
||||
Py_DECREF(getattr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue