Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b99d39

Browse files
committed
gh-120170: Exclude __mp_main__ in C version of whichmodule()
Importing multiprocessing adds an alias to __main__ named __mp_main__.In#23403, the Python version of whichmodule() was fixed to exclude__mp_main__. Apply the same fix to the C version of the function.
1 parent417bec7 commit4b99d39

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix an issue in the:mod:`!_pickle` extension module in which importing
2+
:mod:`multiprocessing` could change how pickle identifies which module an
3+
object belongs to, potentially breaking the unpickling of those objects.

‎Modules/_pickle.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,10 @@ _checkmodule(PyObject *module_name, PyObject *module,
18881888
_PyUnicode_EqualToASCIIString(module_name,"__main__")) {
18891889
return-1;
18901890
}
1891+
if (PyUnicode_Check(module_name)&&
1892+
_PyUnicode_EqualToASCIIString(module_name,"__mp_main__")) {
1893+
return-1;
1894+
}
18911895

18921896
PyObject*candidate=get_deep_attribute(module,dotted_path,NULL);
18931897
if (candidate==NULL) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp