diff --git a/Lib/threading.py b/Lib/threading.py
index c2b94a5045..3cade1e335 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -807,6 +807,7 @@ def _maintain_shutdown_locks():
# Main class for threads
class Thread:
+ BUG = False
"""A class that represents a thread of control.
This class can be safely subclassed in a limited fashion. There are two ways
@@ -1097,6 +1098,9 @@ def _wait_for_tstate_lock(self, block=True, timeout=-1):
if lock is None: # already determined that the C code is done
assert self._is_stopped
elif lock.acquire(block, timeout):
+ if Thread.BUG:
+ Thread.BUG = False
+ raise KeyboardInterrupt
lock.release()
self._stop()