Skip to content

Commit fa8d88f

Browse files
authored
Add ParamSpec to contextlib._(Async)GeneratorContextManager
Refs python#6676
1 parent e434b23 commit fa8d88f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stdlib/contextlib.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _GeneratorContextManager(AbstractContextManager[_T_co], ContextDecorator,
4242
# In Python <= 3.6, __init__ and all instance attributes are defined directly on this class.
4343
# In Python >= 3.7, __init__ and all instance attributes are inherited from _GeneratorContextManagerBase
4444
# _GeneratorContextManagerBase is more trouble than it's worth to include in the stub; see #6676
45-
def __init__(self, func: Callable[..., Iterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
45+
def __init__(self, func: Callable[_P, Iterator[_T_co]], args: _P.args, kwds: _P.kwargs) -> None: ...
4646
gen: Generator[_T_co, Any, Any]
4747
func: Callable[..., Generator[_T_co, Any, Any]]
4848
args: tuple[Any, ...]
@@ -57,15 +57,15 @@ if sys.version_info >= (3, 10):
5757
class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co], AsyncContextDecorator, Generic[_T_co]):
5858
# __init__ and these attributes are actually defined in the base class _GeneratorContextManagerBase,
5959
# which is more trouble than it's worth to include in the stub (see #6676)
60-
def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
60+
def __init__(self, func: Callable[_P, AsyncIterator[_T_co]], args: _P.args, kwds: _P.kwargs) -> None: ...
6161
gen: AsyncGenerator[_T_co, Any]
6262
func: Callable[..., AsyncGenerator[_T_co, Any]]
6363
args: tuple[Any, ...]
6464
kwds: dict[str, Any]
6565

6666
elif sys.version_info >= (3, 7):
6767
class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co], Generic[_T_co]):
68-
def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ...
68+
def __init__(self, func: Callable[_P, AsyncIterator[_T_co]], args: _P.args, kwds: _P.kwargs) -> None: ...
6969
gen: AsyncGenerator[_T_co, Any]
7070
func: Callable[..., AsyncGenerator[_T_co, Any]]
7171
args: tuple[Any, ...]

0 commit comments

Comments
 (0)