summaryrefslogtreecommitdiffstats
path: root/Lib/threading.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-03-31 21:34:42 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-03-31 21:34:42 (GMT)
commitd906ea62c8839a55efc313b4161ce124b6f656f0 (patch)
treec5f108c70ed41d000bfb5c701a18ff578dc0c8d4 /Lib/threading.py
parenta08e8dedc2c857d19153cc6bf3839e101e577c9c (diff)
downloadcpython-d906ea62c8839a55efc313b4161ce124b6f656f0.zip
cpython-d906ea62c8839a55efc313b4161ce124b6f656f0.tar.gz
cpython-d906ea62c8839a55efc313b4161ce124b6f656f0.tar.bz2
fix Thread.ident when it is the main thread or a dummy thread #5632
Diffstat (limited to 'Lib/threading.py')
-rw-r--r--Lib/threading.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index 28a8a2f..13409db 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -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