Skip to content

Commit 51d960e

Browse files
Fix Windows.
1 parent c7a832b commit 51d960e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Lib/threading.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050
_CRLock = None
5151
TIMEOUT_MAX = _thread.TIMEOUT_MAX
5252
_wait_for_threads_fini = _thread._wait_for_threads_fini
53-
_internal_after_fork = _thread._after_fork
53+
try:
54+
_internal_after_fork = _thread._after_fork
55+
except AttributeError:
56+
_internal_after_fork = None
5457
del _thread
5558

5659

@@ -1683,5 +1686,6 @@ def _after_fork():
16831686

16841687

16851688
if hasattr(_os, "register_at_fork"):
1686-
_os.register_at_fork(after_in_child=_internal_after_fork)
1689+
if _internal_after_fork is not None:
1690+
_os.register_at_fork(after_in_child=_internal_after_fork)
16871691
_os.register_at_fork(after_in_child=_after_fork)

0 commit comments

Comments
 (0)