mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Issue 18808: blind attempt to repair some buildbot failures.
test_is_alive_after_fork is failing on some old Linux kernels, but passing on all newer ones. Since virtually anything can go wrong with locks when mixing threads with fork, replace the most likely cause with a redundant simple data member.
This commit is contained in:
parent
b1424a2908
commit
68d7f78703
1 changed files with 6 additions and 1 deletions
|
@ -552,6 +552,10 @@ class Thread:
|
||||||
self._tstate_lock = None
|
self._tstate_lock = None
|
||||||
self._started = Event()
|
self._started = Event()
|
||||||
self._stopped = Event()
|
self._stopped = Event()
|
||||||
|
# _is_stopped should be the same as _stopped.is_set(). The bizarre
|
||||||
|
# duplication is to allow test_is_alive_after_fork to pass on old
|
||||||
|
# Linux kernels. See issue 18808.
|
||||||
|
self._is_stopped = False
|
||||||
self._initialized = True
|
self._initialized = True
|
||||||
# sys.stderr is not stored in the class like
|
# sys.stderr is not stored in the class like
|
||||||
# sys.exc_info since it can be changed between instances
|
# sys.exc_info since it can be changed between instances
|
||||||
|
@ -707,6 +711,7 @@ class Thread:
|
||||||
|
|
||||||
def _stop(self):
|
def _stop(self):
|
||||||
self._stopped.set()
|
self._stopped.set()
|
||||||
|
self._is_stopped = True
|
||||||
|
|
||||||
def _delete(self):
|
def _delete(self):
|
||||||
"Remove current thread from the dict of currently running threads."
|
"Remove current thread from the dict of currently running threads."
|
||||||
|
@ -793,7 +798,7 @@ class Thread:
|
||||||
assert self._initialized, "Thread.__init__() not called"
|
assert self._initialized, "Thread.__init__() not called"
|
||||||
if not self._started.is_set():
|
if not self._started.is_set():
|
||||||
return False
|
return False
|
||||||
if not self._stopped.is_set():
|
if not self._is_stopped:
|
||||||
return True
|
return True
|
||||||
# The Python part of the thread is done, but the C part may still be
|
# The Python part of the thread is done, but the C part may still be
|
||||||
# waiting to run.
|
# waiting to run.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue