mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
threading: fix ExceptHookArgs being a function instead of a type (#4768)
The previous typing meant `threading.ExceptHookArgs` could not be used to type a value. The new typing follows what cpython does in the happy path (`_thread` exists rather than the pure-python fallback being used). Fixes #4767.
This commit is contained in:
@@ -155,13 +155,7 @@ class Event:
|
||||
def wait(self, timeout: Optional[float] = ...) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
import _thread
|
||||
|
||||
# don't ask...
|
||||
_ExceptHookArgs = _thread.ExceptHookArgs
|
||||
ExceptHookArgs = _thread._ExceptHookArgs
|
||||
|
||||
excepthook: Callable[[_ExceptHookArgs], Any]
|
||||
from _thread import _excepthook as excepthook, _ExceptHookArgs as ExceptHookArgs
|
||||
|
||||
class Timer(Thread):
|
||||
if sys.version_info >= (3,):
|
||||
|
||||
@@ -155,13 +155,7 @@ class Event:
|
||||
def wait(self, timeout: Optional[float] = ...) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
import _thread
|
||||
|
||||
# don't ask...
|
||||
_ExceptHookArgs = _thread.ExceptHookArgs
|
||||
ExceptHookArgs = _thread._ExceptHookArgs
|
||||
|
||||
excepthook: Callable[[_ExceptHookArgs], Any]
|
||||
from _thread import _excepthook as excepthook, _ExceptHookArgs as ExceptHookArgs
|
||||
|
||||
class Timer(Thread):
|
||||
if sys.version_info >= (3,):
|
||||
|
||||
Reference in New Issue
Block a user