@@ -3821,27 +3821,15 @@ def __eq__(self, other: object) -> bool:
38213821 __all__ .append ("CapsuleType" )
38223822
38233823
3824- # Using this convoluted approach so that this keeps working
3825- # whether we end up using PEP 649 as written, PEP 749, or
3826- # some other variation: in any case, inspect.get_annotations
3827- # will continue to exist and will gain a `format` parameter.
3828- _PEP_649_OR_749_IMPLEMENTED = (
3829- hasattr (inspect , 'get_annotations' )
3830- and inspect .get_annotations .__kwdefaults__ is not None
3831- and "format" in inspect .get_annotations .__kwdefaults__
3832- )
3833-
3834-
3835- class Format (enum .IntEnum ):
3836- VALUE = 1
3837- VALUE_WITH_FAKE_GLOBALS = 2
3838- FORWARDREF = 3
3839- STRING = 4
3840-
3841-
3842- if _PEP_649_OR_749_IMPLEMENTED :
3843- get_annotations = inspect .get_annotations
3824+ if sys .version_info >= (3 ,14 ):
3825+ from annotationlib import get_annotations , Format
38443826else :
3827+ class Format (enum .IntEnum ):
3828+ VALUE = 1
3829+ VALUE_WITH_FAKE_GLOBALS = 2
3830+ FORWARDREF = 3
3831+ STRING = 4
3832+
38453833 def get_annotations (obj , * , globals = None , locals = None , eval_str = False ,
38463834 format = Format .VALUE ):
38473835 """Compute the annotations dict for an object.
@@ -4122,7 +4110,7 @@ def evaluate_forward_ref(
41224110 globals = None ,
41234111 locals = None ,
41244112 type_params = None ,
4125- format = Format . VALUE ,
4113+ format = None ,
41264114 _recursive_guard = frozenset (),
41274115 ):
41284116 """Evaluate a forward reference as a type hint.
0 commit comments