summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-04-07 09:22:36 (GMT)
committerGitHub <noreply@github.com>2023-04-07 09:22:36 (GMT)
commit059bb04245a8b3490f93dfd72522a431a113eef1 (patch)
tree56678c7ad365debee79fe20ea391792eeb95b04d /Objects/typeobject.c
parentefb0a2cf3adf4629cf4669cb558758fb78107319 (diff)
downloadcpython-059bb04245a8b3490f93dfd72522a431a113eef1.zip
cpython-059bb04245a8b3490f93dfd72522a431a113eef1.tar.gz
cpython-059bb04245a8b3490f93dfd72522a431a113eef1.tar.bz2
gh-102213: Revert "gh-102213: Optimize the performance of `__getattr__` (GH-102248)" (GH-103332)
This reverts commit aa0a73d1bc53dcb6348a869df1e775138991e561.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 24541bd..995547e 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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);