Fix signature for __exit__ (#542)

This commit is contained in:
Guido van Rossum
2016-09-13 11:00:01 -07:00
committed by GitHub
parent 94e0625e82
commit 8b0e6b886d
2 changed files with 6 additions and 2 deletions

View File

@@ -261,7 +261,9 @@ class IO(Iterator[AnyStr], Generic[AnyStr]):
@abstractmethod
def __enter__(self) -> 'IO[AnyStr]': ...
@abstractmethod
def __exit__(self, t: type, value: Any, traceback: Any) -> bool: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException],
# TODO: traceback should be TracebackType but that's defined in types
traceback: Optional[Any]) -> bool: ...
class BinaryIO(IO[str]):
# TODO readinto

View File

@@ -319,7 +319,9 @@ class IO(Iterator[AnyStr], Generic[AnyStr]):
@abstractmethod
def __enter__(self) -> 'IO[AnyStr]': ...
@abstractmethod
def __exit__(self, t: type = None, value: BaseException = None, traceback: Any = None) -> bool: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException],
# TODO: traceback should be TracebackType but that's defined in types
traceback: Optional[Any]) -> bool: ...
class BinaryIO(IO[bytes]):
# TODO readinto