]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-114807: multiprocessing: don't raise ImportError if _multiprocessing is missing...
authorHood Chatham <roberthoodchatham@gmail.com>
Sun, 11 Feb 2024 09:59:50 +0000 (01:59 -0800)
committerGitHub <noreply@github.com>
Sun, 11 Feb 2024 09:59:50 +0000 (01:59 -0800)
`_multiprocessing` is only used under the `if _winapi:` block, this moves the import to be within the `_winapi` ImportError handling try/except for equivalent treatment.

Lib/multiprocessing/connection.py

index dbbf106f680964932768073172c8fd09965d4195..c6a66a1bc963c3acae906682be4dca41d9efcbb9 100644 (file)
@@ -19,7 +19,6 @@ import time
 import tempfile
 import itertools
 
-import _multiprocessing
 
 from . import util
 
@@ -28,6 +27,7 @@ from .context import reduction
 _ForkingPickler = reduction.ForkingPickler
 
 try:
+    import _multiprocessing
     import _winapi
     from _winapi import WAIT_OBJECT_0, WAIT_ABANDONED_0, WAIT_TIMEOUT, INFINITE
 except ImportError: