Skip to content

Commit 4bc7343

Browse files
authored
Fix 3.14 beta break with _handle on thread (#1895)
1 parent 8b5b84a commit 4bc7343

File tree

4 files changed

+3415
-3385
lines changed

4 files changed

+3415
-3385
lines changed

src/debugpy/_vendored/pydevd/_pydev_bundle/pydev_is_thread_alive.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
# It is required to debug threads started by start_new_thread in Python 3.4
66
_temp = threading.Thread()
77

8+
if hasattr(_temp, "_os_thread_handle"): # Python 3.14 and later has this
9+
def is_thread_alive(t):
10+
return not t._os_thread_handle.is_done()
11+
812
if hasattr(_temp, "_handle") and hasattr(_temp, "_started"): # Python 3.13 and later has this
913

1014
def is_thread_alive(t):

src/debugpy/_vendored/pydevd/_pydevd_sys_monitoring/_pydevd_sys_monitoring.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from os.path import basename, splitext
1414

1515
from _pydev_bundle import pydev_log
16+
from _pydev_bundle.pydev_is_thread_alive import is_thread_alive as pydevd_is_thread_alive
1617
from _pydevd_bundle import pydevd_dont_trace
1718
from _pydevd_bundle.pydevd_constants import (
1819
IS_PY313_OR_GREATER,
@@ -267,7 +268,7 @@ def is_thread_alive(self):
267268
if self._use_is_stopped:
268269
return not self.thread._is_stopped
269270
else:
270-
return not self.thread._handle.is_done()
271+
return pydevd_is_thread_alive(self.thread)
271272

272273

273274
class _DeleteDummyThreadOnDel:

0 commit comments

Comments
 (0)