-
-
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
gh-106033: Get rid of PyDict_GetItem in _PyFunction_FromConstructor #106044
gh-106033: Get rid of PyDict_GetItem in _PyFunction_FromConstructor #106044
Conversation
serhiy-storchaka
commented
Jun 23, 2023
•
edited by bedevere-bot
Loading
edited by bedevere-bot
- Issue: PyDict_GetItem and PyObject_HasAttr should not be used #106033
PyObject *module = Py_XNewRef(PyDict_GetItemWithError(constr->fc_globals, &_Py_ID(__name__))); | ||
if (!module && PyErr_Occurred()) { | ||
return NULL; | ||
} | ||
|
||
PyFunctionObject *op = PyObject_GC_New(PyFunctionObject, &PyFunction_Type); | ||
if (op == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Py_XDECREF(module) before this error return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
…ctor (pythonGH-106044) (cherry picked from commit 08c08d2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-106228 is a backport of this pull request to the 3.12 branch. |