Skip to content

Commit 58bb691

Browse files
committed
Fix mypy support
1 parent f4520bd commit 58bb691

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

stdlib/copy.pyi

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import sys
2-
from collections.abc import Callable
32
from typing import Any, Protocol, TypeVar
4-
from typing_extensions import Self
3+
from typing_extensions import ParamSpec, Self
54

65
__all__ = ["Error", "copy", "deepcopy"]
76

87
_T = TypeVar("_T")
9-
_SR = TypeVar("_SR", bound=_SupportsReplace)
8+
_SR = TypeVar("_SR", bound=_SupportsReplace[Any])
9+
_P = ParamSpec("_P")
1010

11-
class _SupportsReplace(Protocol):
12-
__replace__: Callable[..., Self]
11+
class _SupportsReplace(Protocol[_P]):
12+
# In reality doesn't support args, but there's no other great way to express this.
13+
def __replace__(self: Self, *args: _P.args, **kwargs: _P.kwargs) -> Self: ...
1314

1415
# None in CPython but non-None in Jython
1516
PyStringMap: Any

0 commit comments

Comments
 (0)