-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use _PyObject_LookupAttr() instead of PyObject_GetAttr() #106303
Labels
type-feature
A feature request or enhancement
Comments
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Jul 1, 2023
…tr() It simplifies and speed up the code.
This was referenced Jul 1, 2023
serhiy-storchaka
added a commit
that referenced
this issue
Jul 9, 2023
…H-106304) It simplifies and speed up the code.
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Jul 9, 2023
…t_GetAttr() (pythonGH-106304) It simplifies and speed up the code.. (cherry picked from commit 93d292c) Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Jul 9, 2023
…t_GetAttr() (pythonGH-106304) It simplifies and speed up the code. (cherry picked from commit 93d292c) Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PyObject_GetAttr()
followed byPyErr_ExceptionMatches(PyExc_AttributeError)
andPyErr_Clear()
can be replaced with_PyObject_LookupAttr()
. It is faster, because it avoids raising the AttributeError exception which later be caught and dropped at first place. And it leads to simpler code. Most of code already uses_PyObject_LookupAttr()
, but some new code was added recently which still use the old idiom.Linked PRs
The text was updated successfully, but these errors were encountered: