mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Get "stopped" back into repr(Thread) when appropriate.
Due to recent changes, a Thread doesn't know that it's over before someone calls .join() or .is_alive(). That meant repr(Thread) continued to include "started" (and not "stopped") before one of those methods was called, even if hours passed since the thread ended. Repaired that.
This commit is contained in:
parent
b5e9ac9ec6
commit
72460fa68b
2 changed files with 26 additions and 0 deletions
|
|
@ -574,6 +574,7 @@ class Thread:
|
|||
status = "initial"
|
||||
if self._started.is_set():
|
||||
status = "started"
|
||||
self.is_alive() # easy way to get ._is_stopped set when appropriate
|
||||
if self._is_stopped:
|
||||
status = "stopped"
|
||||
if self._daemonic:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue