8000 gh-120170: Exclude __mp_main__ in C version of whichmodule() by li-dan · Pull Request #120171 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-120170: Exclude __mp_main__ in C version of whichmodule() #120171

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

Merged
merged 2 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix an issue in the :mod:`!_pickle` extension module in which importing
:mod:`multiprocessing` could change how pickle identifies which module an
object belongs to, potentially breaking the unpickling of those objects.
4 changes: 4 additions & 0 deletions Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,10 @@ _checkmodule(PyObject *module_name, PyObject *module,
_PyUnicode_EqualToASCIIString(module_name, "__main__")) {
return -1;
}
if (PyUnicode_Check(module_name) &&
_PyUnicode_EqualToASCIIString(module_name, "__mp_main__")) {
return -1;
}

PyObject *candidate = getattribute(module, dotted_path, 0);
if (candidate == NULL) {
Expand Down
Loading
0