Skip to content

Commit 781e996

Browse files
authored
Remove some unnecessary monkeypatching on Python 3.13+ (#379)
1 parent 348f544 commit 781e996

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/typing_extensions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,8 @@ def _check_generic(cls, parameters, elen):
27642764
raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments"
27652765
f" for {cls}; actual {alen}, expected {expect_val}")
27662766

2767-
typing._check_generic = _check_generic
2767+
if not _PEP_696_IMPLEMENTED:
2768+
typing._check_generic = _check_generic
27682769

27692770
# Python 3.11+ _collect_type_vars was renamed to _collect_parameters
27702771
if hasattr(typing, '_collect_type_vars'):
@@ -2836,7 +2837,8 @@ def _collect_parameters(args):
28362837

28372838
return tuple(parameters)
28382839

2839-
typing._collect_parameters = _collect_parameters
2840+
if not _PEP_696_IMPLEMENTED:
2841+
typing._collect_parameters = _collect_parameters
28402842

28412843
# Backport typing.NamedTuple as it exists in Python 3.13.
28422844
# In 3.11, the ability to define generic `NamedTuple`s was supported.

0 commit comments

Comments
 (0)