Fix 3.14 beta break with _handle on thread (#1895)

This commit is contained in:
Rich Chiodo 2025-05-19 11:12:37 -07:00 committed by GitHub
parent 8b5b84aec3
commit 4bc7343c05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 3517 additions and 3487 deletions

View file

@ -5,6 +5,10 @@ from _pydev_bundle._pydev_saved_modules import threading
# It is required to debug threads started by start_new_thread in Python 3.4
_temp = threading.Thread()
if hasattr(_temp, "_os_thread_handle"): # Python 3.14 and later has this
def is_thread_alive(t):
return not t._os_thread_handle.is_done()
if hasattr(_temp, "_handle") and hasattr(_temp, "_started"): # Python 3.13 and later has this
def is_thread_alive(t):

View file

@ -13,6 +13,7 @@ from typing import Dict, Optional, Tuple, Any
from os.path import basename, splitext
from _pydev_bundle import pydev_log
from _pydev_bundle.pydev_is_thread_alive import is_thread_alive as pydevd_is_thread_alive
from _pydevd_bundle import pydevd_dont_trace
from _pydevd_bundle.pydevd_constants import (
IS_PY313_OR_GREATER,
@ -267,7 +268,7 @@ class ThreadInfo:
if self._use_is_stopped:
return not self.thread._is_stopped
else:
return not self.thread._handle.is_done()
return pydevd_is_thread_alive(self.thread)
class _DeleteDummyThreadOnDel:

View file

@ -19,6 +19,7 @@ from typing import Dict, Optional, Tuple, Any
from os.path import basename, splitext
from _pydev_bundle import pydev_log
from _pydev_bundle.pydev_is_thread_alive import is_thread_alive as pydevd_is_thread_alive
from _pydevd_bundle import pydevd_dont_trace
from _pydevd_bundle.pydevd_constants import (
IS_PY313_OR_GREATER,
@ -273,7 +274,7 @@ cdef class ThreadInfo:
if self._use_is_stopped:
return not self.thread._is_stopped
else:
return not self.thread._handle.is_done()
return pydevd_is_thread_alive(self.thread)
class _DeleteDummyThreadOnDel: