diff --git a/stdlib/_ast.pyi b/stdlib/_ast.pyi index 1305b0c94d9b..81cb9ffbf26e 100644 --- a/stdlib/_ast.pyi +++ b/stdlib/_ast.pyi @@ -415,6 +415,8 @@ class Tuple(expr): __match_args__ = ("elts", "ctx") elts: list[expr] ctx: expr_context + if sys.version_info >= (3, 9): + dims: list[expr] class expr_context(AST): ... diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 199e4f2acb68..3a54d158affd 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -259,3 +259,6 @@ if sys.version_info >= (3, 8): def get_source_segment(source: str, node: AST, *, padded: bool = ...) -> str | None: ... def walk(node: AST) -> Iterator[AST]: ... + +if sys.version_info >= (3, 9): + def main() -> None: ... diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 53ef9a9ab040..b24e54826716 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -1,4 +1,3 @@ -_ast.ImportFrom.level _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame @@ -8,7 +7,6 @@ _collections_abc.ItemsView.__reversed__ _collections_abc.KeysView.__reversed__ _collections_abc.ValuesView.__reversed__ _weakref.ProxyType.__reversed__ # Doesn't really exist -ast.ImportFrom.level asyncio.Future.__init__ # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object builtins.dict.get @@ -75,7 +73,6 @@ tempfile.SpooledTemporaryFile.seekable tempfile.SpooledTemporaryFile.writable # Exists at runtime, but missing from stubs -_ast.Tuple.dims _codecs.unregister _collections_abc.AsyncIterable.__class_getitem__ _collections_abc.Awaitable.__class_getitem__ @@ -85,8 +82,6 @@ _collections_abc.MappingView.__class_getitem__ _csv.Reader _csv.Writer _imp.source_hash -ast.Tuple.dims -ast.main asynchat.__warningregistry__ # Removal planned for 3.12, can add if someone needs this bdb.Breakpoint.clearBreakpoints distutils.dist.DistributionMetadata.set_classifiers @@ -194,6 +189,8 @@ os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all Pat ssl.PROTOCOL_SSLv3 # Depends on ssl compilation ssl.RAND_egd # Depends on openssl compilation types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime +_ast.ImportFrom.level # None on the class, but never None on instances +ast.ImportFrom.level # None on the class, but never None on instances # These enums derive from (str, Enum). See comment in py3_common.txt pstats.SortKey.__new__ diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index c02a30f5c5b7..385b5fca40e1 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -1,5 +1,3 @@ -_ast.ImportFrom.level -_ast.Tuple.dims _codecs.unregister _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code @@ -25,9 +23,6 @@ _weakref.ProxyType.__reversed__ # Doesn't really exist argparse._AppendConstAction.__init__ argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group argparse._StoreConstAction.__init__ -ast.ImportFrom.level -ast.Tuple.dims -ast.main asynchat.__warningregistry__ # Removal planned for 3.12, can add if someone needs this asyncio.sslproto.AppProtocolState asyncio.sslproto.SSLAgainErrors @@ -275,6 +270,8 @@ os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all Pat ssl.PROTOCOL_SSLv3 # Depends on ssl compilation ssl.RAND_egd # Depends on openssl compilation types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime +_ast.ImportFrom.level # None on the class, but never None on instances +ast.ImportFrom.level # None on the class, but never None on instances # These enums derive from (str, Enum). See comment in py3_common.txt pstats.SortKey.__new__ diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index f92100ceaa22..8e25b723c91d 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -1,4 +1,3 @@ -_ast.ImportFrom.level _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame @@ -10,7 +9,6 @@ _weakref.ProxyType.__reversed__ # Doesn't really exist ast.Bytes.__new__ ast.Ellipsis.__new__ ast.ExtSlice.__new__ -ast.ImportFrom.level ast.Index.__new__ ast.NameConstant.__new__ ast.Num.__new__ @@ -106,15 +104,12 @@ collections.Mapping.get # Adding None to the Union messed up mypy collections.Sequence.index # Supporting None in end is not mandatory # Exists at runtime, but missing from stubs -_ast.Tuple.dims _collections_abc.AsyncIterable.__class_getitem__ _collections_abc.Awaitable.__class_getitem__ _collections_abc.Container.__class_getitem__ _collections_abc.Iterable.__class_getitem__ _collections_abc.MappingView.__class_getitem__ _imp.source_hash -ast.Tuple.dims -ast.main collections.AsyncIterable.__class_getitem__ collections.Awaitable.__class_getitem__ collections.Container.__class_getitem__ @@ -196,6 +191,8 @@ xml.etree.cElementTree.XMLParser.__init__ ast.FormattedValue.conversion # None on the class, but never None on instances _ast.FormattedValue.conversion # None on the class, but never None on instances +_ast.ImportFrom.level # None on the class, but never None on instances +ast.ImportFrom.level # None on the class, but never None on instances ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem