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
Py_XDECREF() module on fail in Py_mod_exec #90763
Comments
In some of the xx modules, a Py_mod_exec function steals a reference to the module argument when an error occurs (Py_XDECREF(m) after goto fail). It's a bit pernicious given the modules' stated intent to be used as a template, although I'm not sure how often this has actually happened. At the very least, I haven't noticed this outside the xx modules. For Python <= 3.9, this affects xx_exec() in xxmodule.c and xx_modexec() in xxlimited.c. For Python >= 3.10, this affects xx_exec() in xxmodule.c and xx_modexec() in xxlimited_35.c. |
We might as well clean up the whole init functions of those two template modules. For example, xxmodule.c does not check the return value of |
Use C APIs such as PyModule_AddType instead of PyModule_AddObject. Also remove incorrect module decrefs if module fails to initialise.
Use C APIs such as PyModule_AddType instead of PyModule_AddObject. Also remove incorrect module decrefs if module fails to initialise.
Use C APIs such as PyModule_AddType instead of PyModule_AddObject. Also remove incorrect module decrefs if module fails to initialise.
…ythonGH-93078) Use C APIs such as PyModule_AddType instead of PyModule_AddObject. Also remove incorrect module decrefs if module fails to initialise. (cherry picked from commit a87c9b5) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
Use C APIs such as PyModule_AddType instead of PyModule_AddObject. Also remove incorrect module decrefs if module fails to initialise. (cherry picked from commit a87c9b5) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: