diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index bdecdac11..01b23cd7a 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -184,9 +184,6 @@ xml.sax.expatreader # Module members that exist at runtime, but are missing from stubs # ========== _json.encode_basestring -_thread.LockType.acquire_lock -_thread.LockType.locked_lock -_thread.LockType.release_lock _thread.RLock _thread.allocate _thread.exit_thread diff --git a/stdlib/@tests/stubtest_allowlists/py313.txt b/stdlib/@tests/stubtest_allowlists/py313.txt index 37fe35f77..7a96b4b2b 100644 --- a/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/stdlib/@tests/stubtest_allowlists/py313.txt @@ -3,8 +3,6 @@ # ========================= # TODO: triage these new errors -_thread.lock -_thread.start_joinable_thread _tkinter.create doctest.TestResults.__doc__ doctest.TestResults.__new__ diff --git a/stdlib/_thread.pyi b/stdlib/_thread.pyi index 97f8d37cb..b75e7608f 100644 --- a/stdlib/_thread.pyi +++ b/stdlib/_thread.pyi @@ -17,11 +17,28 @@ class LockType: def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... def release(self) -> None: ... def locked(self) -> bool: ... + def acquire_lock(self, blocking: bool = True, timeout: float = -1) -> bool: ... + def release_lock(self) -> None: ... + def locked_lock(self) -> bool: ... def __enter__(self) -> bool: ... def __exit__( self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... +if sys.version_info >= (3, 13): + @final + class _ThreadHandle: + ident: int + + def join(self, timeout: float | None = None, /) -> None: ... + def is_done(self) -> bool: ... + def _set_done(self) -> None: ... + + def start_joinable_thread( + function: Callable[[], object], handle: _ThreadHandle | None = None, daemon: bool = True + ) -> _ThreadHandle: ... + lock = LockType + @overload def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]], /) -> int: ... @overload