Skip to content

Commit 35ad2fa

Browse files
committed
Add _ExitT_co to generator context manager types
1 parent d604bb2 commit 35ad2fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/contextlib.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ class _GeneratorContextManagerBase(Generic[_G_co]):
8585

8686
class _GeneratorContextManager(
8787
_GeneratorContextManagerBase[Generator[_T_co, _SendT_contra, _ReturnT_co]],
88-
AbstractContextManager[_T_co, bool | None],
88+
AbstractContextManager[_T_co, _ExitT_co],
8989
ContextDecorator[_ExcReturnT], # _ExcReturnT is inferred by the type checker
9090
):
9191
def __exit__(
9292
self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
93-
) -> bool | None: ...
93+
) -> _ExitT_co: ...
9494

9595
def contextmanager(func: Callable[_P, Iterator[_T_co]]) -> Callable[_P, _GeneratorContextManager[_T_co]]: ...
9696

@@ -102,12 +102,12 @@ if sys.version_info >= (3, 10):
102102

103103
class _AsyncGeneratorContextManager(
104104
_GeneratorContextManagerBase[AsyncGenerator[_T_co, _SendT_contra]],
105-
AbstractAsyncContextManager[_T_co, bool | None],
105+
AbstractAsyncContextManager[_T_co, _ExitT_co],
106106
AsyncContextDecorator[_ExcReturnT], # _ExcReturnT is inferred by the type checker
107107
):
108108
async def __aexit__(
109109
self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
110-
) -> bool | None: ...
110+
) -> _ExitT_co: ...
111111

112112
else:
113113
class _AsyncGeneratorContextManager(

0 commit comments

Comments
 (0)