Content-Length: 284102 | pFad | http://github.com/python/cpython/commit/05a19b5e56894fd1e63aff6b38fb23ad7c7b3047

B9 gh-120170: Exclude __mp_main__ in C version of whichmodule() (#120171) · python/cpython@05a19b5 · GitHub
Skip to content

Commit 05a19b5

Browse files
li-danlysnikolaou
andauthored
gh-120170: Exclude __mp_main__ in C version of whichmodule() (#120171)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
1 parent 393773a commit 05a19b5

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
@@ -1879,6 +1879,10 @@ _checkmodule(PyObject *module_name, PyObject *module,
18791879
_PyUnicode_EqualToASCIIString(module_name, "__main__")) {
18801880
return -1;
18811881
}
1882+
if (PyUnicode_Check(module_name) &&
1883+
_PyUnicode_EqualToASCIIString(module_name, "__mp_main__")) {
1884+
return -1;
1885+
}
18821886

18831887
PyObject *candidate = getattribute(module, dotted_path, 0);
18841888
if (candidate == NULL) {

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/python/cpython/commit/05a19b5e56894fd1e63aff6b38fb23ad7c7b3047

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy