Skip to content

Commit abb1037

Browse files
committed
pythongh-90876: Prevent a multiprocessing import error.
Prevent `multiprocessing.spawn` from failing to *import* in environments where `sys.executable` is `None`. This regressed in 3.11 with the addition of support for path-like objects in multiprocessing.
1 parent 70e2a42 commit abb1037

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Lib/multiprocessing/spawn.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535

3636
def set_executable(exe):
3737
global _python_exe
38-
if sys.platform == 'win32':
38+
if exe is None:
39+
_python_exe = exe
40+
elif sys.platform == 'win32':
3941
_python_exe = os.fsdecode(exe)
4042
else:
4143
_python_exe = os.fsencode(exe)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Prevent :mod:`multiprocessing.spawn` from failing to *import* in environments
2+
where ``sys.executable`` is ``None``. This regressed in 3.11 with the addition
3+
of support for path-like objects in multiprocessing.

0 commit comments

Comments
 (0)