gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr()#106304
gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr()#106304serhiy-storchaka merged 2 commits intopython:mainfrom
Conversation
…tr() It simplifies and speed up the code.
| return -1; | ||
| PyObject *value; | ||
| int res = _PyObject_LookupAttr(wrapped, name, &value); | ||
| if (value != NULL) { |
There was a problem hiding this comment.
How about adding an assert before reassignment?
assert(res > 0);There was a problem hiding this comment.
This was not necessary in many other cases where a similar idiom is used.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry @serhiy-storchaka, I had trouble checking out the |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
|
GH-106568 is a backport of this pull request to the 3.12 branch. |
…t_GetAttr() (pythonGH-106304) It simplifies and speed up the code.. (cherry picked from commit 93d292c) Co-authored-by: Serhiy Storchaka <[email protected]>
|
GH-106569 is a backport of this pull request to the 3.11 branch. |
…t_GetAttr() (pythonGH-106304) It simplifies and speed up the code. (cherry picked from commit 93d292c) Co-authored-by: Serhiy Storchaka <[email protected]>
It simplifies and speed up the code.