3.14: add annotationlib, update typing and inspect (#13985)

This commit is contained in:
Jelle Zijlstra
2025-05-10 14:25:06 -07:00
committed by GitHub
parent 8bd5455b32
commit 5ff32f377c
10 changed files with 488 additions and 477 deletions
+26 -333
View File
@@ -2,117 +2,6 @@
# TODO: New errors in Python 3.14 that need to be fixed or moved below
# ====================================================================
_ast.Add.__annotations_cache__
_ast.And.__annotations_cache__
_ast.AnnAssign.__annotations_cache__
_ast.Assert.__annotations_cache__
_ast.Assign.__annotations_cache__
_ast.AsyncFor.__annotations_cache__
_ast.AsyncFunctionDef.__annotations_cache__
_ast.AsyncWith.__annotations_cache__
_ast.Attribute.__annotations_cache__
_ast.AugAssign.__annotations_cache__
_ast.Await.__annotations_cache__
_ast.BinOp.__annotations_cache__
_ast.BitAnd.__annotations_cache__
_ast.BitOr.__annotations_cache__
_ast.BitXor.__annotations_cache__
_ast.BoolOp.__annotations_cache__
_ast.Break.__annotations_cache__
_ast.Call.__annotations_cache__
_ast.ClassDef.__annotations_cache__
_ast.Compare.__annotations_cache__
_ast.Constant.__annotations_cache__
_ast.Continue.__annotations_cache__
_ast.Del.__annotations_cache__
_ast.Delete.__annotations_cache__
_ast.Dict.__annotations_cache__
_ast.DictComp.__annotations_cache__
_ast.Div.__annotations_cache__
_ast.Eq.__annotations_cache__
_ast.ExceptHandler.__annotations_cache__
_ast.Expr.__annotations_cache__
_ast.Expression.__annotations_cache__
_ast.FloorDiv.__annotations_cache__
_ast.For.__annotations_cache__
_ast.FormattedValue.__annotations_cache__
_ast.FunctionDef.__annotations_cache__
_ast.FunctionType.__annotations_cache__
_ast.GeneratorExp.__annotations_cache__
_ast.Global.__annotations_cache__
_ast.Gt.__annotations_cache__
_ast.GtE.__annotations_cache__
_ast.If.__annotations_cache__
_ast.IfExp.__annotations_cache__
_ast.Import.__annotations_cache__
_ast.ImportFrom.__annotations_cache__
_ast.In.__annotations_cache__
_ast.Interactive.__annotations_cache__
_ast.Invert.__annotations_cache__
_ast.Is.__annotations_cache__
_ast.IsNot.__annotations_cache__
_ast.JoinedStr.__annotations_cache__
_ast.LShift.__annotations_cache__
_ast.Lambda.__annotations_cache__
_ast.List.__annotations_cache__
_ast.ListComp.__annotations_cache__
_ast.Load.__annotations_cache__
_ast.Lt.__annotations_cache__
_ast.LtE.__annotations_cache__
_ast.MatMult.__annotations_cache__
_ast.Match.__annotations_cache__
_ast.MatchAs.__annotations_cache__
_ast.MatchClass.__annotations_cache__
_ast.MatchMapping.__annotations_cache__
_ast.MatchOr.__annotations_cache__
_ast.MatchSequence.__annotations_cache__
_ast.MatchSingleton.__annotations_cache__
_ast.MatchStar.__annotations_cache__
_ast.MatchValue.__annotations_cache__
_ast.Mod.__annotations_cache__
_ast.Module.__annotations_cache__
_ast.Mult.__annotations_cache__
_ast.Name.__annotations_cache__
_ast.NamedExpr.__annotations_cache__
_ast.Nonlocal.__annotations_cache__
_ast.Not.__annotations_cache__
_ast.NotEq.__annotations_cache__
_ast.NotIn.__annotations_cache__
_ast.Or.__annotations_cache__
_ast.ParamSpec.__annotations_cache__
_ast.Pass.__annotations_cache__
_ast.Pow.__annotations_cache__
_ast.RShift.__annotations_cache__
_ast.Raise.__annotations_cache__
_ast.Return.__annotations_cache__
_ast.Set.__annotations_cache__
_ast.SetComp.__annotations_cache__
_ast.Slice.__annotations_cache__
_ast.Starred.__annotations_cache__
_ast.Store.__annotations_cache__
_ast.Sub.__annotations_cache__
_ast.Subscript.__annotations_cache__
_ast.Try.__annotations_cache__
_ast.TryStar.__annotations_cache__
_ast.Tuple.__annotations_cache__
_ast.TypeAlias.__annotations_cache__
_ast.TypeIgnore.__annotations_cache__
_ast.TypeVar.__annotations_cache__
_ast.TypeVarTuple.__annotations_cache__
_ast.UAdd.__annotations_cache__
_ast.USub.__annotations_cache__
_ast.UnaryOp.__annotations_cache__
_ast.While.__annotations_cache__
_ast.With.__annotations_cache__
_ast.Yield.__annotations_cache__
_ast.YieldFrom.__annotations_cache__
_ast.alias.__annotations_cache__
_ast.arg.__annotations_cache__
_ast.arguments.__annotations_cache__
_ast.comprehension.__annotations_cache__
_ast.keyword.__annotations_cache__
_ast.match_case.__annotations_cache__
_ast.withitem.__annotations_cache__
_asyncio.all_tasks
_asyncio.future_add_to_awaited_by
_asyncio.future_discard_from_awaited_by
@@ -136,121 +25,9 @@ _socket.if_indextoname
_ssl.HAS_PHA
_thread.RLock.locked
_thread.set_name
annotationlib
argparse.HelpFormatter.__init__
ast.Add.__annotations_cache__
ast.And.__annotations_cache__
ast.AnnAssign.__annotations_cache__
ast.Assert.__annotations_cache__
ast.Assign.__annotations_cache__
ast.AsyncFor.__annotations_cache__
ast.AsyncFunctionDef.__annotations_cache__
ast.AsyncWith.__annotations_cache__
ast.Attribute.__annotations_cache__
ast.AugAssign.__annotations_cache__
ast.Await.__annotations_cache__
ast.BinOp.__annotations_cache__
ast.BitAnd.__annotations_cache__
ast.BitOr.__annotations_cache__
ast.BitXor.__annotations_cache__
ast.BoolOp.__annotations_cache__
ast.Break.__annotations_cache__
ast.Call.__annotations_cache__
ast.ClassDef.__annotations_cache__
ast.Compare.__annotations_cache__
ast.Constant.__annotations_cache__
ast.Continue.__annotations_cache__
ast.Del.__annotations_cache__
ast.Delete.__annotations_cache__
ast.Dict.__annotations_cache__
ast.DictComp.__annotations_cache__
ast.Div.__annotations_cache__
ast.Eq.__annotations_cache__
ast.ExceptHandler.__annotations_cache__
ast.Expr.__annotations_cache__
ast.Expression.__annotations_cache__
ast.FloorDiv.__annotations_cache__
ast.For.__annotations_cache__
ast.FormattedValue.__annotations_cache__
ast.FunctionDef.__annotations_cache__
ast.FunctionType.__annotations_cache__
ast.GeneratorExp.__annotations_cache__
ast.Global.__annotations_cache__
ast.Gt.__annotations_cache__
ast.GtE.__annotations_cache__
ast.If.__annotations_cache__
ast.IfExp.__annotations_cache__
ast.Import.__annotations_cache__
ast.ImportFrom.__annotations_cache__
ast.In.__annotations_cache__
ast.Interactive.__annotations_cache__
ast.Interpolation
ast.Invert.__annotations_cache__
ast.Is.__annotations_cache__
ast.IsNot.__annotations_cache__
ast.JoinedStr.__annotations_cache__
ast.LShift.__annotations_cache__
ast.Lambda.__annotations_cache__
ast.List.__annotations_cache__
ast.ListComp.__annotations_cache__
ast.Load.__annotations_cache__
ast.Lt.__annotations_cache__
ast.LtE.__annotations_cache__
ast.MatMult.__annotations_cache__
ast.Match.__annotations_cache__
ast.MatchAs.__annotations_cache__
ast.MatchClass.__annotations_cache__
ast.MatchMapping.__annotations_cache__
ast.MatchOr.__annotations_cache__
ast.MatchSequence.__annotations_cache__
ast.MatchSingleton.__annotations_cache__
ast.MatchStar.__annotations_cache__
ast.MatchValue.__annotations_cache__
ast.Mod.__annotations_cache__
ast.Module.__annotations_cache__
ast.Mult.__annotations_cache__
ast.Name.__annotations_cache__
ast.NamedExpr.__annotations_cache__
ast.Nonlocal.__annotations_cache__
ast.Not.__annotations_cache__
ast.NotEq.__annotations_cache__
ast.NotIn.__annotations_cache__
ast.Or.__annotations_cache__
ast.ParamSpec.__annotations_cache__
ast.Pass.__annotations_cache__
ast.Pow.__annotations_cache__
ast.RShift.__annotations_cache__
ast.Raise.__annotations_cache__
ast.Return.__annotations_cache__
ast.Set.__annotations_cache__
ast.SetComp.__annotations_cache__
ast.Slice.__annotations_cache__
ast.Starred.__annotations_cache__
ast.Store.__annotations_cache__
ast.Sub.__annotations_cache__
ast.Subscript.__annotations_cache__
ast.TemplateStr
ast.Try.__annotations_cache__
ast.TryStar.__annotations_cache__
ast.Tuple.__annotations_cache__
ast.TypeAlias.__annotations_cache__
ast.TypeIgnore.__annotations_cache__
ast.TypeVar.__annotations_cache__
ast.TypeVarTuple.__annotations_cache__
ast.UAdd.__annotations_cache__
ast.USub.__annotations_cache__
ast.UnaryOp.__annotations_cache__
ast.While.__annotations_cache__
ast.With.__annotations_cache__
ast.Yield.__annotations_cache__
ast.YieldFrom.__annotations_cache__
ast.alias.__annotations_cache__
ast.arg.__annotations_cache__
ast.arguments.__annotations_cache__
ast.comprehension.__annotations_cache__
ast.keyword.__annotations_cache__
ast.match_case.__annotations_cache__
ast.withitem.__annotations_cache__
asyncio.__all__
asyncio.FrameCallGraphEntry
asyncio.FutureCallGraph
@@ -293,7 +70,6 @@ builtins.int.__round__
builtins.memoryview.__class_getitem__
builtins.staticmethod.__annotate__
builtins.staticmethod.__class_getitem__
builtins.type.__annotate__
code.compile_command
codeop.compile_command
compression
@@ -337,8 +113,6 @@ dataclasses.Field.doc
dataclasses.field
dataclasses.make_dataclass
decimal.Decimal.from_number
decimal.DecimalTuple.__annotate_func__
decimal.DecimalTuple.__annotations_cache__
decimal.IEEE_CONTEXT_MAX_BITS
dis.Bytecode.__init__
dis.Instruction.make
@@ -376,25 +150,8 @@ importlib.abc.Traversable
importlib.abc.TraversableResources
importlib.machinery.__all__
importlib.machinery.AppleFrameworkLoader
importlib.metadata.PackageMetadata.__annotate_func__
importlib.metadata.PackageMetadata.__annotations_cache__
importlib.metadata._meta.PackageMetadata.__annotate_func__
importlib.metadata._meta.PackageMetadata.__annotations_cache__
importlib.metadata._meta.SimplePath.__annotate_func__
importlib.metadata._meta.SimplePath.__annotations_cache__
importlib.resources.abc.Traversable.__annotate_func__
importlib.resources.abc.Traversable.__annotations_cache__
importlib.util.__all__
importlib.util.Loader
inspect.__all__
inspect.CO_HAS_DOCSTRING
inspect.CO_METHOD
inspect.Signature.format
inspect.Signature.from_callable
inspect.formatannotation
inspect.get_annotations
inspect.ispackage
inspect.signature
io.__all__
io.Reader
io.Writer
@@ -439,10 +196,6 @@ pdb.set_trace
pkgutil.__all__
pkgutil.find_loader
pkgutil.get_loader
pstats.FunctionProfile.__annotate_func__
pstats.FunctionProfile.__annotations_cache__
pstats.StatsProfile.__annotate_func__
pstats.StatsProfile.__annotations_cache__
pyexpat.errors.XML_ERROR_NOT_STARTED
shutil.__all__
socket.__all__
@@ -480,81 +233,6 @@ turtle.poly
turtle.save
types.CodeType.co_branches
types.FrameType.f_generator
types.FunctionType.__annotate__
types.LambdaType.__annotate__
types.ModuleType.__annotate__
types.UnionType.__class_getitem__
types.UnionType.__mro_entries__
types.UnionType.__name__
types.UnionType.__qualname__
typing.__all__
typing.ForwardRef.__arg__
typing.ForwardRef.__ast_node__
typing.ForwardRef.__cell__
typing.ForwardRef.__code__
typing.ForwardRef.__extra_names__
typing.ForwardRef.__forward_arg__
typing.ForwardRef.__forward_code__
typing.ForwardRef.__globals__
typing.ForwardRef.__init__
typing.ForwardRef.__init_subclass__
typing.ForwardRef.__owner__
typing.ForwardRef.__stringifier_dict__
typing.ForwardRef.evaluate
typing.ParamSpec.evaluate_default
typing.SupportsAbs.__annotate_func__
typing.SupportsAbs.__annotations_cache__
typing.SupportsBytes.__annotate_func__
typing.SupportsBytes.__annotations_cache__
typing.SupportsComplex.__annotate_func__
typing.SupportsComplex.__annotations_cache__
typing.SupportsFloat.__annotate_func__
typing.SupportsFloat.__annotations_cache__
typing.SupportsIndex.__annotate_func__
typing.SupportsIndex.__annotations_cache__
typing.SupportsInt.__annotate_func__
typing.SupportsInt.__annotations_cache__
typing.SupportsRound.__annotate_func__
typing.SupportsRound.__annotations_cache__
typing.TypeAliasType.evaluate_value
typing.TypeVar.evaluate_bound
typing.TypeVar.evaluate_constraints
typing.TypeVar.evaluate_default
typing.TypeVarTuple.evaluate_default
typing.Union
typing.evaluate_forward_ref
typing.get_type_hints
typing_extensions.ForwardRef.__arg__
typing_extensions.ForwardRef.__ast_node__
typing_extensions.ForwardRef.__cell__
typing_extensions.ForwardRef.__code__
typing_extensions.ForwardRef.__extra_names__
typing_extensions.ForwardRef.__forward_arg__
typing_extensions.ForwardRef.__forward_code__
typing_extensions.ForwardRef.__globals__
typing_extensions.ForwardRef.__init__
typing_extensions.ForwardRef.__init_subclass__
typing_extensions.ForwardRef.__owner__
typing_extensions.ForwardRef.__stringifier_dict__
typing_extensions.ForwardRef.evaluate
typing_extensions.SupportsAbs.__annotate_func__
typing_extensions.SupportsAbs.__annotations_cache__
typing_extensions.SupportsBytes.__annotate_func__
typing_extensions.SupportsBytes.__annotations_cache__
typing_extensions.SupportsComplex.__annotate_func__
typing_extensions.SupportsComplex.__annotations_cache__
typing_extensions.SupportsFloat.__annotate_func__
typing_extensions.SupportsFloat.__annotations_cache__
typing_extensions.SupportsIndex.__annotate_func__
typing_extensions.SupportsIndex.__annotations_cache__
typing_extensions.SupportsInt.__annotate_func__
typing_extensions.SupportsInt.__annotations_cache__
typing_extensions.SupportsRound.__annotate_func__
typing_extensions.SupportsRound.__annotations_cache__
typing_extensions.TypeAliasType.evaluate_value
typing_extensions.Union
typing_extensions.evaluate_forward_ref
typing_extensions.get_type_hints
unittest.TestCase.assertEndsWith
unittest.TestCase.assertHasAttr
unittest.TestCase.assertIsSubclass
@@ -576,21 +254,10 @@ urllib.request.FancyURLopener
urllib.request.URLopener
urllib.request.pathname2url
urllib.request.url2pathname
wsgiref.types.ErrorStream.__annotate_func__
wsgiref.types.ErrorStream.__annotations_cache__
wsgiref.types.FileWrapper.__annotate_func__
wsgiref.types.FileWrapper.__annotations_cache__
wsgiref.types.InputStream.__annotate_func__
wsgiref.types.InputStream.__annotations_cache__
wsgiref.types.StartResponse.__annotate_func__
wsgiref.types.StartResponse.__annotations_cache__
wsgiref.types._Readable.__annotate_func__
wsgiref.types._Readable.__annotations_cache__
xml.parsers.expat.errors.XML_ERROR_NOT_STARTED
xml.sax.__all__
xml.sax.InputSource
zipfile.ZipFile.data_offset
zipfile._path.glob.Translator.__annotate_func__
# =========================
@@ -598,6 +265,14 @@ zipfile._path.glob.Translator.__annotate_func__
# =========================
# Union and UnionType are aliases in 3.14 but type checkers need some changes
typing_extensions.Union
typing.Union
types.UnionType.__class_getitem__
types.UnionType.__mro_entries__
types.UnionType.__name__
types.UnionType.__qualname__
# ====================================
# Pre-existing errors from Python 3.13
# ====================================
@@ -650,6 +325,24 @@ typing(_extensions)?\.IO\.truncate
typing(_extensions)?\.IO\.write
typing(_extensions)?\.IO\.writelines
# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.14
# =============================================================
# Internal annotations machinery
.*\.__annotate_func__
.*\.__annotations_cache__
# Undocumented private attributes
.*\.ForwardRef\.__arg__
.*\.ForwardRef\.__ast_node__
.*\.ForwardRef\.__cell__
.*\.ForwardRef\.__code__
.*\.ForwardRef\.__extra_names__
.*\.ForwardRef\.__globals__
.*\.ForwardRef\.__init_subclass__
.*\.ForwardRef\.__owner__
.*\.ForwardRef\.__stringifier_dict__
# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.13