From 92b600540e600e238828a72ca4915bc283fa32a1 Mon Sep 17 00:00:00 2001 From: Alvaro Caceres Date: Fri, 7 Oct 2016 15:11:47 -0500 Subject: [PATCH] Add private members to stdlib threading (#590) * Add threading._DummyThread * Make threading.RLock a factory function, not a class Will break code that currently uses a threading.RLock type annotation --- stdlib/2and3/threading.pyi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/stdlib/2and3/threading.pyi b/stdlib/2and3/threading.pyi index 2b81bbe8f..bcb7c862a 100644 --- a/stdlib/2and3/threading.pyi +++ b/stdlib/2and3/threading.pyi @@ -76,6 +76,10 @@ class Thread: def setDaemon(self, daemonic: bool) -> None: ... +class _DummyThread(Thread): + pass + + class Lock: def __init__(self) -> None: ... def __enter__(self) -> bool: ... @@ -89,7 +93,7 @@ class Lock: def release(self) -> None: ... -class RLock: +class _RLock: def __init__(self) -> None: ... def __enter__(self) -> bool: ... def __exit__(self, exc_type: Optional[Type[BaseException]], @@ -102,8 +106,11 @@ class RLock: def release(self) -> None: ... +def RLock() -> _RLock: ... + + class Condition: - def __init__(self, lock: Union[Lock, RLock, None] = ...) -> None: ... + def __init__(self, lock: Union[Lock, _RLock, None] = ...) -> None: ... def __enter__(self) -> bool: ... def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[Exception],