mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 22:56:55 +08:00
Update type of "throw" method of generators to reflect that it can return a value (#1672)
This commit is contained in:
committed by
Jelle Zijlstra
parent
9a10c74345
commit
0b721b7af5
@@ -115,7 +115,7 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
@abstractmethod
|
||||
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = None,
|
||||
# TODO: tb should be TracebackType but that's defined in types
|
||||
tb: Any = None) -> None: ...
|
||||
tb: Any = None) -> _T_co: ...
|
||||
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
|
||||
@@ -122,7 +122,7 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
|
||||
@abstractmethod
|
||||
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ...,
|
||||
tb: Optional[TracebackType] = ...) -> None: ...
|
||||
tb: Optional[TracebackType] = ...) -> _T_co: ...
|
||||
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
@@ -149,7 +149,7 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
|
||||
@abstractmethod
|
||||
def throw(self, typ: Type[BaseException], val: Optional[BaseException] = ...,
|
||||
tb: Optional[TracebackType] = ...) -> None: ...
|
||||
tb: Optional[TracebackType] = ...) -> _T_co: ...
|
||||
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user