mirror of
https://github.com/python/cpython.git
synced 2025-07-27 21:24:32 +00:00
fix Thread.ident when it is the main thread or a dummy thread #5632
This commit is contained in:
parent
a08e8dedc2
commit
d906ea62c8
3 changed files with 22 additions and 1 deletions
|
@ -500,9 +500,12 @@ class Thread(_Verbose):
|
|||
return
|
||||
raise
|
||||
|
||||
def _set_ident(self):
|
||||
self.__ident = _get_ident()
|
||||
|
||||
def __bootstrap_inner(self):
|
||||
try:
|
||||
self.__ident = _get_ident()
|
||||
self._set_ident()
|
||||
self.__started.set()
|
||||
with _active_limbo_lock:
|
||||
_active[self.__ident] = self
|
||||
|
@ -733,6 +736,7 @@ class _MainThread(Thread):
|
|||
def __init__(self):
|
||||
Thread.__init__(self, name="MainThread")
|
||||
self._Thread__started.set()
|
||||
self._set_ident()
|
||||
with _active_limbo_lock:
|
||||
_active[_get_ident()] = self
|
||||
|
||||
|
@ -778,6 +782,7 @@ class _DummyThread(Thread):
|
|||
del self._Thread__block
|
||||
|
||||
self._Thread__started.set()
|
||||
self._set_ident()
|
||||
with _active_limbo_lock:
|
||||
_active[_get_ident()] = self
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue