From b406ba9315f9df8e8632df8f9a7ef477b8a60073 Mon Sep 17 00:00:00 2001 From: Max Muoto Date: Sat, 10 Aug 2024 18:00:52 -0500 Subject: [PATCH] Add `_recreate_cm` to `ContextDecorator` and `AsyncContextDecorator` (#12479) --- stdlib/contextlib.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 29ac7cde5..daf218d5a 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -55,6 +55,7 @@ class AbstractAsyncContextManager(Protocol[_T_co, _ExitT_co]): ) -> _ExitT_co: ... class ContextDecorator: + def _recreate_cm(self) -> Self: ... def __call__(self, func: _F) -> _F: ... class _GeneratorContextManager(AbstractContextManager[_T_co, bool | None], ContextDecorator): @@ -80,6 +81,7 @@ if sys.version_info >= (3, 10): _AF = TypeVar("_AF", bound=Callable[..., Awaitable[Any]]) class AsyncContextDecorator: + def _recreate_cm(self) -> Self: ... def __call__(self, func: _AF) -> _AF: ... class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co, bool | None], AsyncContextDecorator):