From 1b486cc2630bd2d1e098ae5632ed4b3c42a74448 Mon Sep 17 00:00:00 2001 From: Amin Alaee Date: Thu, 6 Aug 2026 09:11:31 +0200 Subject: [PATCH 1/2] Update copy.deepcopy signature for Python 3.15 --- stdlib/@tests/stubtest_allowlists/py315.txt | 1 - stdlib/copy.pyi | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py315.txt b/stdlib/@tests/stubtest_allowlists/py315.txt index 7354dac4dc90..e99551a48ae0 100644 --- a/stdlib/@tests/stubtest_allowlists/py315.txt +++ b/stdlib/@tests/stubtest_allowlists/py315.txt @@ -17,7 +17,6 @@ _struct.pack _struct.pack_into _thread.RLock.__exit__ _thread.lock.__exit__ -copy.deepcopy dataclasses.MISSING dataclasses._MISSING_TYPE dataclasses.field diff --git a/stdlib/copy.pyi b/stdlib/copy.pyi index 373899ea2635..27927c0c78f5 100644 --- a/stdlib/copy.pyi +++ b/stdlib/copy.pyi @@ -14,10 +14,14 @@ class _SupportsReplace(Protocol[_RT_co]): # None in CPython but non-None in Jython PyStringMap: Any -# Note: memo and _nil are internal kwargs. -def deepcopy(x: _T, memo: dict[int, Any] | None = None, _nil: Any = []) -> _T: ... def copy(x: _T) -> _T: ... +if sys.version_info >= (3, 15): + def deepcopy(x: _T, memo: dict[int, Any] | None = None) -> _T: ... +else: + # Note: memo and _nil are internal kwargs. + def deepcopy(x: _T, memo: dict[int, Any] | None = None, _nil: Any = []) -> _T: ... + if sys.version_info >= (3, 13): __all__ += ["replace"] # The types accepted by `**changes` match those of `obj.__replace__`. From bff71af35161694b4823547340ed3b7cd2603fd0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 07:14:04 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/copy.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/copy.pyi b/stdlib/copy.pyi index 27927c0c78f5..925bed1aada2 100644 --- a/stdlib/copy.pyi +++ b/stdlib/copy.pyi @@ -18,6 +18,7 @@ def copy(x: _T) -> _T: ... if sys.version_info >= (3, 15): def deepcopy(x: _T, memo: dict[int, Any] | None = None) -> _T: ... + else: # Note: memo and _nil are internal kwargs. def deepcopy(x: _T, memo: dict[int, Any] | None = None, _nil: Any = []) -> _T: ...