File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1068,21 +1068,18 @@ def _after_fork():
10681068 current = current_thread ()
10691069 with _active_limbo_lock :
10701070 for thread in _active .values ():
1071+ # Any lock/condition variable may be currently locked or in an
1072+ # invalid state, so we reinitialize them.
1073+ thread ._reset_internal_locks ()
10711074 if thread is current :
10721075 # There is only one active thread. We reset the ident to
10731076 # its new value since it can have changed.
10741077 ident = _get_ident ()
10751078 thread ._ident = ident
1076- # Any condition variables hanging off of the active thread may
1077- # be in an invalid state, so we reinitialize them.
1078- thread ._reset_internal_locks ()
10791079 new_active [ident ] = thread
10801080 else :
10811081 # All the others are already stopped.
1082- # We don't call _Thread__stop() because it tries to acquire
1083- # thread._Thread__block which could also have been held while
1084- # we forked.
1085- thread ._stopped = True
1082+ thread ._stop ()
10861083
10871084 _limbo .clear ()
10881085 _active .clear ()
Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ Core and Builtins
9797Library
9898-------
9999
100+ - Issue #11870: threading: Properly reinitialize threads internal locks and
101+ condition variables to avoid deadlocks in child processes.
102+
100103- Issue #8035: urllib: Fix a bug where the client could remain stuck after a
101104 redirection or an error.
102105
You can’t perform that action at this time.
0 commit comments