Skip to content

Commit d77d848

Browse files
contextlib: Use bound TypeVar (#7764)
1 parent 9effb64 commit d77d848

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/contextlib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ _F = TypeVar("_F", bound=Callable[..., Any])
7878
_P = ParamSpec("_P")
7979

8080
_ExitFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], bool | None]
81-
_CM_EF = TypeVar("_CM_EF", AbstractContextManager[Any], _ExitFunc)
81+
_CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any] | _ExitFunc)
8282

8383
class ContextDecorator:
8484
def __call__(self, func: _F) -> _F: ...
@@ -177,7 +177,7 @@ class ExitStack(AbstractContextManager[ExitStack]):
177177

178178
if sys.version_info >= (3, 7):
179179
_ExitCoroFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], Awaitable[bool]]
180-
_ACM_EF = TypeVar("_ACM_EF", AbstractAsyncContextManager[Any], _ExitCoroFunc)
180+
_ACM_EF = TypeVar("_ACM_EF", bound=AbstractAsyncContextManager[Any] | _ExitCoroFunc)
181181

182182
class AsyncExitStack(AbstractAsyncContextManager[AsyncExitStack]):
183183
def __init__(self) -> None: ...

0 commit comments

Comments
 (0)