1414import typing
1515import warnings
1616
17+ # Breakpoint: https://github.com/python/cpython/pull/119891
1718if sys .version_info >= (3 , 14 ):
1819 import annotationlib
1920
152153# for backward compatibility
153154PEP_560 = True
154155GenericMeta = type
156+ # Breakpoint: https://github.com/python/cpython/pull/116129
155157_PEP_696_IMPLEMENTED = sys .version_info >= (3 , 13 , 0 , "beta" )
156158
157159# Added with bpo-45166 to 3.10.1+ and some 3.9 versions
@@ -169,6 +171,7 @@ def __repr__(self):
169171_marker = _Sentinel ()
170172
171173
174+ # Breakpoint: https://github.com/python/cpython/pull/27342
172175if sys .version_info >= (3 , 10 ):
173176 def _should_collect_from_parameters (t ):
174177 return isinstance (
@@ -190,6 +193,7 @@ def _should_collect_from_parameters(t):
190193T_contra = typing .TypeVar ('T_contra' , contravariant = True ) # Ditto contravariant.
191194
192195
196+ # Breakpoint: https://github.com/python/cpython/pull/31841
193197if sys .version_info >= (3 , 11 ):
194198 from typing import Any
195199else :
@@ -278,6 +282,7 @@ def __repr__(self):
278282
279283Final = typing .Final
280284
285+ # Breakpoint: https://github.com/python/cpython/pull/30530
281286if sys .version_info >= (3 , 11 ):
282287 final = typing .final
283288else :
@@ -321,6 +326,7 @@ def IntVar(name):
321326
322327
323328# A Literal bug was fixed in 3.11.0, 3.10.1 and 3.9.8
329+ # Breakpoint: https://github.com/python/cpython/pull/29334
324330if sys .version_info >= (3 , 10 , 1 ):
325331 Literal = typing .Literal
326332else :
@@ -481,6 +487,7 @@ def clear_overloads():
481487TYPE_CHECKING = typing .TYPE_CHECKING
482488
483489
490+ # Breakpoint: https://github.com/python/cpython/pull/118681
484491if sys .version_info >= (3 , 13 , 0 , "beta" ):
485492 from typing import AsyncContextManager , AsyncGenerator , ContextManager , Generator
486493else :
@@ -591,6 +598,7 @@ def _caller(depth=1, default='__main__'):
591598
592599# `__match_args__` attribute was removed from protocol members in 3.13,
593600# we want to backport this change to older Python versions.
601+ # Breakpoint: https://github.com/python/cpython/pull/110683
594602if sys .version_info >= (3 , 13 ):
595603 Protocol = typing .Protocol
596604else :
@@ -771,6 +779,7 @@ def __init_subclass__(cls, *args, **kwargs):
771779 cls .__init__ = _no_init
772780
773781
782+ # Breakpoint: https://github.com/python/cpython/pull/113401
774783if sys .version_info >= (3 , 13 ):
775784 runtime_checkable = typing .runtime_checkable
776785else :
@@ -831,6 +840,7 @@ def close(self): ...
831840
832841
833842# Our version of runtime-checkable protocols is faster on Python <=3.11
843+ # Breakpoint: https://github.com/python/cpython/pull/112717
834844if sys .version_info >= (3 , 12 ):
835845 SupportsInt = typing .SupportsInt
836846 SupportsFloat = typing .SupportsFloat
@@ -1160,6 +1170,7 @@ def __new__(cls, name, bases, ns, *, total=True, closed=None,
11601170 mutable_keys .add (annotation_key )
11611171 readonly_keys .discard (annotation_key )
11621172
1173+ # Breakpoint: https://github.com/python/cpython/pull/119891
11631174 if sys .version_info >= (3 , 14 ):
11641175 def __annotate__ (format ):
11651176 annos = {}
@@ -1250,6 +1261,7 @@ def _create_typeddict(
12501261 raise TypeError ("TypedDict takes either a dict or keyword arguments,"
12511262 " but not both" )
12521263 if kwargs :
1264+ # Breakpoint: https://github.com/python/cpython/pull/104891
12531265 if sys .version_info >= (3 , 13 ):
12541266 raise TypeError ("TypedDict takes no keyword arguments" )
12551267 warnings .warn (
@@ -1459,6 +1471,7 @@ def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
14591471 hint = typing .get_type_hints (
14601472 obj , globalns = globalns , localns = localns , include_extras = True
14611473 )
1474+ # Breakpoint: https://github.com/python/cpython/pull/30304
14621475 if sys .version_info < (3 , 11 ):
14631476 _clean_optional (obj , hint , globalns , localns )
14641477 if include_extras :
@@ -1531,7 +1544,8 @@ def _clean_optional(obj, hints, globalns=None, localns=None):
15311544
15321545# Python 3.9 has get_origin() and get_args() but those implementations don't support
15331546# ParamSpecArgs and ParamSpecKwargs, so only Python 3.10's versions will do.
1534- if sys .version_info [:2 ] >= (3 , 10 ):
1547+ # Breakpoint: https://github.com/python/cpython/pull/25298
1548+ if sys .version_info >= (3 , 10 ):
15351549 get_origin = typing .get_origin
15361550 get_args = typing .get_args
15371551# 3.9
@@ -2097,6 +2111,7 @@ def _concatenate_getitem(self, parameters):
20972111
20982112
20992113# 3.11+; Concatenate does not accept ellipsis in 3.10
2114+ # Breakpoint: https://github.com/python/cpython/pull/30969
21002115if sys .version_info >= (3 , 11 ):
21012116 Concatenate = typing .Concatenate
21022117# <=3.10
@@ -2433,7 +2448,9 @@ def foo(**kwargs: Unpack[Movie]): ...
24332448"""
24342449
24352450
2436- if sys .version_info >= (3 , 12 ): # PEP 692 changed the repr of Unpack[]
2451+ # PEP 692 changed the repr of Unpack[]
2452+ # Breakpoint: https://github.com/python/cpython/pull/104048
2453+ if sys .version_info >= (3 , 12 ):
24372454 Unpack = typing .Unpack
24382455
24392456 def _is_unpack (obj ):
@@ -2696,8 +2713,9 @@ def int_or_str(arg: int | str) -> None:
26962713 raise AssertionError (f"Expected code to be unreachable, but got: { value } " )
26972714
26982715
2716+ # dataclass_transform exists in 3.11 but lacks the frozen_default parameter
2717+ # Breakpoint: https://github.com/python/cpython/pull/99958
26992718if sys .version_info >= (3 , 12 ): # 3.12+
2700- # dataclass_transform exists in 3.11 but lacks the frozen_default parameter
27012719 dataclass_transform = typing .dataclass_transform
27022720else : # <=3.11
27032721 def dataclass_transform (
@@ -2828,6 +2846,7 @@ def method(self) -> None:
28282846
28292847
28302848# Python 3.13.3+ contains a fix for the wrapped __new__
2849+ # Breakpoint: https://github.com/python/cpython/pull/132160
28312850if sys .version_info >= (3 , 13 , 3 ):
28322851 deprecated = warnings .deprecated
28332852else :
@@ -2957,6 +2976,7 @@ def wrapper(*args, **kwargs):
29572976 return arg (* args , ** kwargs )
29582977
29592978 if asyncio .coroutines .iscoroutinefunction (arg ):
2979+ # Breakpoint: https://github.com/python/cpython/pull/99247
29602980 if sys .version_info >= (3 , 12 ):
29612981 wrapper = inspect .markcoroutinefunction (wrapper )
29622982 else :
@@ -2970,6 +2990,7 @@ def wrapper(*args, **kwargs):
29702990 f"a class or callable, not { arg !r} "
29712991 )
29722992
2993+ # Breakpoint: https://github.com/python/cpython/pull/23702
29732994if sys .version_info < (3 , 10 ):
29742995 def _is_param_expr (arg ):
29752996 return arg is ... or isinstance (
@@ -3046,6 +3067,7 @@ def _check_generic(cls, parameters, elen=_marker):
30463067
30473068 expect_val = f"at least { elen } "
30483069
3070+ # Breakpoint: https://github.com/python/cpython/pull/27515
30493071 things = "arguments" if sys .version_info >= (3 , 10 ) else "parameters"
30503072 raise TypeError (f"Too { 'many' if alen > elen else 'few' } { things } "
30513073 f" for { cls } ; actual { alen } , expected { expect_val } " )
@@ -3239,6 +3261,7 @@ def _collect_parameters(args):
32393261# This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8.
32403262# On 3.12, we added __orig_bases__ to call-based NamedTuples
32413263# On 3.13, we deprecated kwargs-based NamedTuples
3264+ # Breakpoint: https://github.com/python/cpython/pull/105609
32423265if sys .version_info >= (3 , 13 ):
32433266 NamedTuple = typing .NamedTuple
32443267else :
@@ -3314,6 +3337,7 @@ def __new__(cls, typename, bases, ns):
33143337 # using add_note() until py312.
33153338 # Making sure exceptions are raised in the same way
33163339 # as in "normal" classes seems most important here.
3340+ # Breakpoint: https://github.com/python/cpython/pull/95915
33173341 if sys .version_info >= (3 , 12 ):
33183342 e .add_note (msg )
33193343 raise
@@ -3462,6 +3486,7 @@ class Baz(list[str]): ...
34623486
34633487# NewType is a class on Python 3.10+, making it pickleable
34643488# The error message for subclassing instances of NewType was improved on 3.11+
3489+ # Breakpoint: https://github.com/python/cpython/pull/30268
34653490if sys .version_info >= (3 , 11 ):
34663491 NewType = typing .NewType
34673492else :
@@ -3514,6 +3539,7 @@ def __repr__(self):
35143539 def __reduce__ (self ):
35153540 return self .__qualname__
35163541
3542+ # Breakpoint: https://github.com/python/cpython/pull/21515
35173543 if sys .version_info >= (3 , 10 ):
35183544 # PEP 604 methods
35193545 # It doesn't make sense to have these methods on Python <3.10
@@ -3525,10 +3551,12 @@ def __ror__(self, other):
35253551 return typing .Union [other , self ]
35263552
35273553
3554+ # Breakpoint: https://github.com/python/cpython/pull/124795
35283555if sys .version_info >= (3 , 14 ):
35293556 TypeAliasType = typing .TypeAliasType
35303557# <=3.13
35313558else :
3559+ # Breakpoint: https://github.com/python/cpython/pull/103764
35323560 if sys .version_info >= (3 , 12 ):
35333561 # 3.12-3.13
35343562 def _is_unionable (obj ):
@@ -3724,6 +3752,7 @@ def __init_subclass__(cls, *args, **kwargs):
37243752 def __call__ (self ):
37253753 raise TypeError ("Type alias is not callable" )
37263754
3755+ # Breakpoint: https://github.com/python/cpython/pull/21515
37273756 if sys .version_info >= (3 , 10 ):
37283757 def __or__ (self , right ):
37293758 # For forward compatibility with 3.12, reject Unions
@@ -3836,15 +3865,19 @@ def __eq__(self, other: object) -> bool:
38363865 __all__ .append ("CapsuleType" )
38373866
38383867
3839- if sys .version_info >= (3 ,14 ):
3868+ if sys .version_info >= (3 , 14 ):
38403869 from annotationlib import Format , get_annotations
38413870else :
3871+ # Available since Python 3.14.0a3
3872+ # PR: https://github.com/python/cpython/pull/124415
38423873 class Format (enum .IntEnum ):
38433874 VALUE = 1
38443875 VALUE_WITH_FAKE_GLOBALS = 2
38453876 FORWARDREF = 3
38463877 STRING = 4
38473878
3879+ # Available since Python 3.14.0a1
3880+ # PR: https://github.com/python/cpython/pull/119891
38483881 def get_annotations (obj , * , globals = None , locals = None , eval_str = False ,
38493882 format = Format .VALUE ):
38503883 """Compute the annotations dict for an object.
@@ -4182,6 +4215,7 @@ def __repr__(self):
41824215 def __call__ (self , * args , ** kwargs ):
41834216 raise TypeError (f"{ type (self ).__name__ !r} object is not callable" )
41844217
4218+ # Breakpoint: https://github.com/python/cpython/pull/21515
41854219 if sys .version_info >= (3 , 10 ):
41864220 def __or__ (self , other ):
41874221 return typing .Union [self , other ]
0 commit comments