8000 [3.7] bpo-42406: Fix whichmodule() with multiprocessing (pythonGH-23403) · faucct/cpython@3eb8095 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3eb8095

Browse files
authored
[3.7] bpo-42406: Fix whichmodule() with multiprocessing (pythonGH-23403)
1 parent d5650a1 commit 3eb8095

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/pickle.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ def whichmodule(obj, name):
307307
# Protect the iteration by using a list copy of sys.modules against dynamic
308308
# modules that trigger imports of other modules upon calls to getattr.
309309
for module_name, module in list(sys.modules.items()):
310-
if module_name == '__main__' or module is None:
310+
if (module_name == '__main__'
311+
or module_name == '__mp_main__' # bpo-42406
312+
or module is None):
311313
continue
312314
try:
313315
if _getattribute(module, name)[0] is obj:

0 commit comments

Comments
 (0)
0