Skip to content

Commit bac955b

Browse files
committed
Add _ExitT_co to generator context manager types
1 parent c6534ee commit bac955b

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
@@ -87,12 +87,12 @@ class _GeneratorContextManagerBase(Generic[_G_co]):
8787

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

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

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

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

114114
else:
115115
class _AsyncGeneratorContextManager(

0 commit comments

Comments
 (0)