diff --git a/stdlib/@python2/_dummy_threading.pyi b/stdlib/@python2/_dummy_threading.pyi index 10fbc938f..c03c52a79 100644 --- a/stdlib/@python2/_dummy_threading.pyi +++ b/stdlib/@python2/_dummy_threading.pyi @@ -6,7 +6,25 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] -__all__: list[str] +__all__ = [ + "activeCount", + "active_count", + "Condition", + "currentThread", + "current_thread", + "enumerate", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Timer", + "setprofile", + "settrace", + "local", + "stack_size", +] def active_count() -> int: ... def activeCount() -> int: ... diff --git a/stdlib/@python2/threading.pyi b/stdlib/@python2/threading.pyi index 5f66360bf..611552dc9 100644 --- a/stdlib/@python2/threading.pyi +++ b/stdlib/@python2/threading.pyi @@ -6,7 +6,25 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] -__all__: list[str] +__all__ = [ + "activeCount", + "active_count", + "Condition", + "currentThread", + "current_thread", + "enumerate", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Timer", + "setprofile", + "settrace", + "local", + "stack_size", +] def active_count() -> int: ... def activeCount() -> int: ... diff --git a/stdlib/_dummy_threading.pyi b/stdlib/_dummy_threading.pyi index 854a30ace..f63bec448 100644 --- a/stdlib/_dummy_threading.pyi +++ b/stdlib/_dummy_threading.pyi @@ -8,7 +8,56 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] _T = TypeVar("_T") -__all__: list[str] +if sys.version_info >= (3, 8): + __all__ = [ + "get_ident", + "active_count", + "Condition", + "current_thread", + "enumerate", + "main_thread", + "TIMEOUT_MAX", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Barrier", + "BrokenBarrierError", + "Timer", + "ThreadError", + "setprofile", + "settrace", + "local", + "stack_size", + "excepthook", + "ExceptHookArgs", + ] +else: + __all__ = [ + "get_ident", + "active_count", + "Condition", + "current_thread", + "enumerate", + "main_thread", + "TIMEOUT_MAX", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Barrier", + "BrokenBarrierError", + "Timer", + "ThreadError", + "setprofile", + "settrace", + "local", + "stack_size", + ] def active_count() -> int: ... def current_thread() -> Thread: ... @@ -16,10 +65,6 @@ def currentThread() -> Thread: ... def get_ident() -> int: ... def enumerate() -> list[Thread]: ... def main_thread() -> Thread: ... - -if sys.version_info >= (3, 8): - from _thread import get_native_id as get_native_id - def settrace(func: _TF) -> None: ... def setprofile(func: _PF | None) -> None: ... def stack_size(size: int = ...) -> int: ... diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index 11aa06aa6..b9b44e0be 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -8,7 +8,86 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]] _PF = Callable[[FrameType, str, Any], None] _T = TypeVar("_T") -__all__: list[str] +if sys.version_info >= (3, 10): + __all__ = [ + "get_ident", + "active_count", + "Condition", + "current_thread", + "enumerate", + "main_thread", + "TIMEOUT_MAX", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Barrier", + "BrokenBarrierError", + "Timer", + "ThreadError", + "setprofile", + "settrace", + "local", + "stack_size", + "excepthook", + "ExceptHookArgs", + "gettrace", + "getprofile", + "get_native_id", + ] +elif sys.version_info >= (3, 8): + __all__ = [ + "get_ident", + "active_count", + "Condition", + "current_thread", + "enumerate", + "main_thread", + "TIMEOUT_MAX", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Barrier", + "BrokenBarrierError", + "Timer", + "ThreadError", + "setprofile", + "settrace", + "local", + "stack_size", + "excepthook", + "ExceptHookArgs", + "get_native_id", + ] +else: + __all__ = [ + "get_ident", + "active_count", + "Condition", + "current_thread", + "enumerate", + "main_thread", + "TIMEOUT_MAX", + "Event", + "Lock", + "RLock", + "Semaphore", + "BoundedSemaphore", + "Thread", + "Barrier", + "BrokenBarrierError", + "Timer", + "ThreadError", + "setprofile", + "settrace", + "local", + "stack_size", + ] def active_count() -> int: ... def activeCount() -> int: ... # deprecated alias for active_count() diff --git a/tests/stubtest_allowlists/py36.txt b/tests/stubtest_allowlists/py36.txt index 60849a3a1..12d36153f 100644 --- a/tests/stubtest_allowlists/py36.txt +++ b/tests/stubtest_allowlists/py36.txt @@ -26,6 +26,10 @@ distutils.cygwinccompiler.RE_VERSION distutils.dist.command_re distutils.fancy_getopt.longopt_re distutils.fancy_getopt.neg_alias_re +dummy_threading.Condition.acquire +dummy_threading.Condition.release +dummy_threading.Event.isSet +dummy_threading.local.__new__ enum.Enum._generate_next_value_ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve hmac.HMAC.__init__ @@ -125,26 +129,8 @@ distutils.command.bdist_wininst distutils.command.bdist_wininst.bdist_wininst distutils.sysconfig.expand_makefile_vars distutils.sysconfig.get_python_version -dummy_threading.Barrier -dummy_threading.BoundedSemaphore -dummy_threading.BrokenBarrierError -dummy_threading.Condition -dummy_threading.Event dummy_threading.Lock dummy_threading.RLock -dummy_threading.Semaphore -dummy_threading.TIMEOUT_MAX -dummy_threading.Thread -dummy_threading.ThreadError -dummy_threading.Timer -dummy_threading.active_count -dummy_threading.current_thread -dummy_threading.enumerate -dummy_threading.get_ident -dummy_threading.local -dummy_threading.main_thread -dummy_threading.setprofile -dummy_threading.settrace dummy_threading.stack_size html.parser.HTMLParser.unescape platform.popen diff --git a/tests/stubtest_allowlists/py37.txt b/tests/stubtest_allowlists/py37.txt index 7b0f3cc6e..86b5e7c6e 100644 --- a/tests/stubtest_allowlists/py37.txt +++ b/tests/stubtest_allowlists/py37.txt @@ -25,6 +25,10 @@ collections.UserString.maketrans contextvars.Context.__init__ # Default C __init__ signature is wrong contextvars.ContextVar.get dataclasses.field +dummy_threading.Condition.acquire +dummy_threading.Condition.release +dummy_threading.Event.isSet +dummy_threading.local.__new__ enum.Enum._generate_next_value_ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve hmac.HMAC.__init__ @@ -102,26 +106,8 @@ distutils.cygwinccompiler.RE_VERSION distutils.dist.command_re distutils.fancy_getopt.longopt_re distutils.fancy_getopt.neg_alias_re -dummy_threading.Barrier -dummy_threading.BoundedSemaphore -dummy_threading.BrokenBarrierError -dummy_threading.Condition -dummy_threading.Event dummy_threading.Lock dummy_threading.RLock -dummy_threading.Semaphore -dummy_threading.TIMEOUT_MAX -dummy_threading.Thread -dummy_threading.ThreadError -dummy_threading.Timer -dummy_threading.active_count -dummy_threading.current_thread -dummy_threading.enumerate -dummy_threading.get_ident -dummy_threading.local -dummy_threading.main_thread -dummy_threading.setprofile -dummy_threading.settrace dummy_threading.stack_size html.parser.HTMLParser.unescape platform.popen diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 3130706f0..46bb16c0d 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -29,6 +29,11 @@ collections.KeysView.__reversed__ collections.ValuesView.__reversed__ contextvars.Context.__init__ # Default C __init__ signature is wrong dataclasses.field +dummy_threading.Condition.acquire +dummy_threading.Condition.release +dummy_threading.Event.isSet +dummy_threading.Thread.native_id +dummy_threading.local.__new__ enum.Enum._generate_next_value_ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 @@ -115,28 +120,9 @@ distutils.cygwinccompiler.RE_VERSION distutils.dist.command_re distutils.fancy_getopt.longopt_re distutils.fancy_getopt.neg_alias_re -dummy_threading.Barrier -dummy_threading.BoundedSemaphore -dummy_threading.BrokenBarrierError -dummy_threading.Condition -dummy_threading.Event dummy_threading.ExceptHookArgs dummy_threading.Lock dummy_threading.RLock -dummy_threading.Semaphore -dummy_threading.TIMEOUT_MAX -dummy_threading.Thread -dummy_threading.ThreadError -dummy_threading.Timer -dummy_threading.active_count -dummy_threading.current_thread -dummy_threading.enumerate -dummy_threading.excepthook -dummy_threading.get_ident -dummy_threading.local -dummy_threading.main_thread -dummy_threading.setprofile -dummy_threading.settrace dummy_threading.stack_size html.parser.HTMLParser.unescape multiprocessing.managers.SharedMemoryServer.create