From afcae431e7bc6890810609d0b74173e361faac9a Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Wed, 16 Aug 2023 23:27:16 +0100 Subject: [PATCH 1/3] Deduplication pass one --- tests/stubtest_allowlists/py310.txt | 43 +--------------------- tests/stubtest_allowlists/py311.txt | 40 --------------------- tests/stubtest_allowlists/py312.txt | 43 ---------------------- tests/stubtest_allowlists/py38.txt | 44 ----------------------- tests/stubtest_allowlists/py39.txt | 44 ----------------------- tests/stubtest_allowlists/py3_common.txt | 45 ++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 213 deletions(-) diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 1a8fd567bbae..5fcdf0f1b948 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -1,16 +1,6 @@ -_collections_abc.AsyncGenerator.ag_await -_collections_abc.AsyncGenerator.ag_code -_collections_abc.AsyncGenerator.ag_frame -_collections_abc.AsyncGenerator.ag_running _collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also. -_collections_abc.ItemsView.__reversed__ -_collections_abc.KeysView.__reversed__ -_collections_abc.ValuesView.__reversed__ _weakref.ProxyType.__reversed__ # Doesn't really exist -asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them -asyncio.Future.__init__ # Usually initialized from c object -asyncio.futures.Future.__init__ # Usually initialized from c object builtins.float.__setformat__ # Internal method for CPython test suite builtins.property.__set_name__ # Doesn't actually exist bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set @@ -18,32 +8,21 @@ configparser.ParsingError.filename contextlib.AbstractAsyncContextManager.__class_getitem__ contextlib.AbstractContextManager.__class_getitem__ enum.Enum._generate_next_value_ -fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -functools.cached_property.__set__ # Stub is a white lie; see comments in the stub functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically gettext.install gettext.translation -hmac.new # Stub is a white lie; see comments in the stub importlib.abc.Finder.find_module importlib.metadata._meta.SimplePath.__truediv__ # See comments in the stub -ipaddress.IPv4Interface.hostmask -ipaddress.IPv6Interface.hostmask -ipaddress._BaseNetwork.broadcast_address -ipaddress._BaseNetwork.hostmask -multiprocessing.spawn._main -pickle.Pickler.reducer_override # implemented in C pickler # platform.uname_result's processor field is now dynamically made to exist platform.uname_result.__match_args__ platform.uname_result.__new__ platform.uname_result.processor -sys.UnraisableHookArgs # Not exported from sys tkinter.Tk.split types.GenericAlias.__getattr__ types.GenericAlias.__mro_entries__ types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 typing._SpecialForm.__mro_entries__ weakref.ProxyType.__reversed__ # Doesn't really exist -weakref.WeakValueDictionary.update typing_extensions\.get_original_bases # Exist at runtime for internal reasons, no need to put them in the stub @@ -90,12 +69,6 @@ _csv.Writer bdb.Breakpoint.clearBreakpoints inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this inspect.Signature.from_function # Removed in 3.11, can add if someone needs this -multiprocessing.managers.SharedMemoryServer.create -multiprocessing.managers.SharedMemoryServer.list_segments -multiprocessing.managers.SharedMemoryServer.public -multiprocessing.managers.SharedMemoryServer.release_segment -multiprocessing.managers.SharedMemoryServer.shutdown -multiprocessing.managers.SharedMemoryServer.track_segment # ========== # Related to positional-only arguments @@ -151,20 +124,10 @@ pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typesh pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522 # C signature is broader than what is actually accepted -ast.Bytes.__new__ -ast.Ellipsis.__new__ ast.ExtSlice.__new__ ast.Index.__new__ -ast.NameConstant.__new__ -ast.Num.__new__ -ast.Str.__new__ -queue.SimpleQueue.__init__ -xml.etree.ElementTree.XMLParser.__init__ -xml.etree.cElementTree.XMLParser.__init__ - -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 -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 @@ -181,7 +144,6 @@ typing_extensions\.reveal_type typing.NewType.__call__ # Super-special typing primitives -typing_extensions\.Final typing\.NamedTuple typing\.Annotated @@ -198,6 +160,3 @@ asynchat.async_chat.use_encoding asynchat.find_prefix_at_end pkgutil.ImpImporter\..* pkgutil.ImpLoader\..* - -# Omit internal _KEEP argument -tarfile.TarInfo.replace diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index d8834e92363a..35eef14b8834 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -1,15 +1,8 @@ -_collections_abc.AsyncGenerator.ag_await -_collections_abc.AsyncGenerator.ag_code -_collections_abc.AsyncGenerator.ag_frame -_collections_abc.AsyncGenerator.ag_running _collections_abc.AsyncIterable.__class_getitem__ _collections_abc.Awaitable.__class_getitem__ _collections_abc.Container.__class_getitem__ -_collections_abc.ItemsView.__reversed__ _collections_abc.Iterable.__class_getitem__ -_collections_abc.KeysView.__reversed__ _collections_abc.MappingView.__class_getitem__ -_collections_abc.ValuesView.__reversed__ _csv.Reader _csv.Writer bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set @@ -20,24 +13,10 @@ enum.Enum._generate_next_value_ # Not strictly speaking a staticmethod on 3.11, but it acts like one: enum.StrEnum._generate_next_value_ importlib.abc.Finder.find_module -ipaddress._BaseNetwork.broadcast_address -ipaddress._BaseNetwork.hostmask -ipaddress.IPv4Interface.hostmask -ipaddress.IPv6Interface.hostmask -multiprocessing.managers.SharedMemoryServer.create -multiprocessing.managers.SharedMemoryServer.list_segments -multiprocessing.managers.SharedMemoryServer.public -multiprocessing.managers.SharedMemoryServer.release_segment -multiprocessing.managers.SharedMemoryServer.shutdown -multiprocessing.managers.SharedMemoryServer.track_segment -multiprocessing.spawn._main -queue.SimpleQueue.__init__ -sys.UnraisableHookArgs # Not exported from sys tkinter._VersionInfoType.__doc__ typing_extensions\.get_original_bases typing.NewType.__call__ typing.NewType.__mro_entries__ -weakref.WeakValueDictionary.update # ========== # Related to positional-only arguments @@ -82,41 +61,23 @@ _collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in _weakref.ProxyType.__reversed__ # Doesn't really exist ast.ImportFrom.level # None on the class, but never None on instances argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group # deprecated, forwards arguments to super -asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them -asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them builtins.property.__set_name__ # Doesn't actually exist dataclasses.KW_ONLY # white lies around defaults enum.auto.__init__ # The stub for enum.auto is nothing like the implementation enum.auto.value # The stub for enum.auto is nothing like the implementation -fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically -functools.cached_property.__set__ # Stub is a white lie; see comments in the stub -hmac.new # Stub is a white lie; see comments in the stub http.HTTPMethod.description # mutable instance attribute at runtime but we pretend it's a property inspect._ParameterKind.description # Still exists, but stubtest can't see it os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem -pickle.Pickler.reducer_override # implemented in C pickler -types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 types.GenericAlias.__getattr__ types.GenericAlias.__mro_entries__ weakref.ProxyType.__reversed__ # Doesn't really exist # C signature is broader than what is actually accepted -ast.Bytes.__new__ -ast.Ellipsis.__new__ ast.ExtSlice.__new__ ast.Index.__new__ -ast.NameConstant.__new__ -ast.Num.__new__ -ast.Str.__new__ -asyncio.futures.Future.__init__ -asyncio.Future.__init__ contextvars.Context.__init__ -queue.SimpleQueue.__init__ -xml.etree.ElementTree.XMLParser.__init__ -xml.etree.cElementTree.XMLParser.__init__ # Treated an alias of a typing class in the stubs, # they are generic to type checkers anyway. @@ -134,7 +95,6 @@ unittest.case.TestCase.__init_subclass__ # Super-special typing primitives typing\._SpecialForm.* -typing_extensions\.Final typing\.NamedTuple typing\.LiteralString typing\.Annotated diff --git a/tests/stubtest_allowlists/py312.txt b/tests/stubtest_allowlists/py312.txt index a01dbb861640..9489cdc697c4 100644 --- a/tests/stubtest_allowlists/py312.txt +++ b/tests/stubtest_allowlists/py312.txt @@ -94,39 +94,18 @@ turtle.__all__ turtle.teleport # Errors that also existed on Python 3.11 -_collections_abc.AsyncGenerator.ag_await -_collections_abc.AsyncGenerator.ag_code -_collections_abc.AsyncGenerator.ag_frame -_collections_abc.AsyncGenerator.ag_running _collections_abc.AsyncIterable.__class_getitem__ _collections_abc.Awaitable.__class_getitem__ _collections_abc.Container.__class_getitem__ -_collections_abc.ItemsView.__reversed__ _collections_abc.Iterable.__class_getitem__ -_collections_abc.KeysView.__reversed__ _collections_abc.MappingView.__class_getitem__ -_collections_abc.ValuesView.__reversed__ _csv.Reader _csv.Writer configparser.LegacyInterpolation.__init__ enum.Enum.__init__ -ipaddress._BaseNetwork.broadcast_address -ipaddress._BaseNetwork.hostmask -ipaddress.IPv4Interface.hostmask -ipaddress.IPv6Interface.hostmask -multiprocessing.managers.SharedMemoryServer.create -multiprocessing.managers.SharedMemoryServer.list_segments -multiprocessing.managers.SharedMemoryServer.public -multiprocessing.managers.SharedMemoryServer.release_segment -multiprocessing.managers.SharedMemoryServer.shutdown -multiprocessing.managers.SharedMemoryServer.track_segment -multiprocessing.spawn._main -queue.SimpleQueue.__init__ -sys.UnraisableHookArgs # Not exported from sys tkinter._VersionInfoType.__doc__ typing.NewType.__call__ typing.NewType.__mro_entries__ -weakref.WeakValueDictionary.update # ========== # Related to positional-only arguments @@ -174,41 +153,23 @@ _collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in _weakref.ProxyType.__reversed__ # Doesn't really exist argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group # deprecated, forwards arguments to super ast.ImportFrom.level # None on the class, but never None on instances -asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them -asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them builtins.property.__set_name__ # Doesn't actually exist dataclasses.KW_ONLY # white lies around defaults enum.auto.__init__ # The stub for enum.auto is nothing like the implementation enum.auto.value # The stub for enum.auto is nothing like the implementation -fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically -functools.cached_property.__set__ # Stub is a white lie; see comments in the stub -hmac.new # Stub is a white lie; see comments in the stub http.HTTPMethod.description # mutable instance attribute at runtime but we pretend it's a property inspect._ParameterKind.description # Still exists, but stubtest can't see it os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem -pickle.Pickler.reducer_override # implemented in C pickler -types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 types.GenericAlias.__getattr__ types.GenericAlias.__mro_entries__ weakref.ProxyType.__reversed__ # Doesn't really exist # C signature is broader than what is actually accepted -ast.Bytes.__new__ -ast.Ellipsis.__new__ ast.ExtSlice.__new__ ast.Index.__new__ -ast.NameConstant.__new__ -ast.Num.__new__ -ast.Str.__new__ -asyncio.futures.Future.__init__ -asyncio.Future.__init__ contextvars.Context.__init__ -queue.SimpleQueue.__init__ -xml.etree.ElementTree.XMLParser.__init__ -xml.etree.cElementTree.XMLParser.__init__ # Treated an alias of a typing class in the stubs, # they are generic to type checkers anyway. @@ -226,10 +187,6 @@ unittest.case.TestCase.__init_subclass__ # Super-special typing primitives typing\._SpecialForm.* -typing_extensions\.Final typing\.NamedTuple typing\.LiteralString typing\.Annotated - -# Omit internal _KEEP argument -tarfile.TarInfo.replace diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 1d164a9b916f..d76c7c15989d 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -1,20 +1,4 @@ -_collections_abc.AsyncGenerator.ag_await -_collections_abc.AsyncGenerator.ag_code -_collections_abc.AsyncGenerator.ag_frame -_collections_abc.AsyncGenerator.ag_running -_collections_abc.ItemsView.__reversed__ -_collections_abc.KeysView.__reversed__ -_collections_abc.ValuesView.__reversed__ _dummy_threading -ast.Bytes.__new__ -ast.Ellipsis.__new__ -ast.NameConstant.__new__ -ast.Num.__new__ -ast.Str.__new__ -asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them -asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them -asyncio.Future.__init__ # Usually initialized from c object -asyncio.futures.Future.__init__ # Usually initialized from c object asyncio.locks._ContextManagerMixin.__enter__ # Always raises; deliberately omitted from the stub asyncio.locks._ContextManagerMixin.__exit__ # Always raises; deliberately omitted from the stub asyncio.transports.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself @@ -43,34 +27,20 @@ dummy_threading.Event.isSet dummy_threading.Thread.native_id dummy_threading.local.__new__ enum.Enum._generate_next_value_ -fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 -functools.cached_property.__set__ # Stub is a white lie; see comments in the stub gettext.install # codeset default value is ['unspecified'] so can't be specified gettext.translation # codeset default value is ['unspecified'] so can't be specified -hmac.new # Stub is a white lie; see comments in the stub importlib.abc.Finder.find_module inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this inspect.Signature.from_function # Removed in 3.11, can add if someone needs this -ipaddress.IPv4Interface.hostmask -ipaddress.IPv6Interface.hostmask -ipaddress._BaseNetwork.broadcast_address -ipaddress._BaseNetwork.hostmask -multiprocessing.spawn._main -pickle.Pickler.reducer_override # implemented in C pickler random.Random.randrange # missing undocumented arg _int sched.Event.__doc__ # __slots__ is overridden -sys.UnraisableHookArgs # Not exported from sys typing.NamedTuple.__new__ typing.NamedTuple._asdict typing.NamedTuple._make typing.NamedTuple._replace typing._SpecialForm.__new__ -weakref.WeakValueDictionary.update xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 -xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature xml.etree.cElementTree.TreeBuilder.start # bpo-39495 -xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature typing_extensions\.get_original_bases # Exist at runtime for internal reasons, no need to put them in the stub @@ -108,12 +78,6 @@ dummy_threading.ExceptHookArgs dummy_threading.Lock dummy_threading.RLock html.parser.HTMLParser.unescape -multiprocessing.managers.SharedMemoryServer.create -multiprocessing.managers.SharedMemoryServer.list_segments -multiprocessing.managers.SharedMemoryServer.public -multiprocessing.managers.SharedMemoryServer.release_segment -multiprocessing.managers.SharedMemoryServer.shutdown -multiprocessing.managers.SharedMemoryServer.track_segment plistlib.Data.asBase64 plistlib.Data.fromBase64 tempfile.SpooledTemporaryFile.softspace @@ -164,11 +128,6 @@ collections.Set.__rxor__ builtins.memoryview.__iter__ # C type that implements __getitem__ builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only -# C signature is broader than what is actually accepted -queue.SimpleQueue.__init__ - -types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime - # Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) builtins.classmethod.__get__ builtins.property.__get__ @@ -202,6 +161,3 @@ asynchat.async_chat.use_encoding asynchat.find_prefix_at_end pkgutil.ImpImporter\..* pkgutil.ImpLoader\..* - -# Omit internal _KEEP argument -tarfile.TarInfo.replace diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index f43cfd20aadc..85dc5b7bfed6 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -1,22 +1,6 @@ -_collections_abc.AsyncGenerator.ag_await -_collections_abc.AsyncGenerator.ag_code -_collections_abc.AsyncGenerator.ag_frame -_collections_abc.AsyncGenerator.ag_running -_collections_abc.ItemsView.__reversed__ -_collections_abc.KeysView.__reversed__ -_collections_abc.ValuesView.__reversed__ _weakref.ProxyType.__reversed__ # Doesn't really exist -ast.Bytes.__new__ -ast.Ellipsis.__new__ ast.ExtSlice.__new__ ast.Index.__new__ -ast.NameConstant.__new__ -ast.Num.__new__ -ast.Str.__new__ -asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them -asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them -asyncio.Future.__init__ # Usually initialized from c object -asyncio.futures.Future.__init__ # Usually initialized from c object builtins.float.__setformat__ # Internal method for CPython test suite builtins.input # Incorrect default value in text signature, fixed in 3.10 bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set @@ -38,33 +22,21 @@ configparser.ParsingError.filename contextlib.AbstractAsyncContextManager.__class_getitem__ contextlib.AbstractContextManager.__class_getitem__ enum.Enum._generate_next_value_ -fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve -functools.cached_property.__set__ # Stub is a white lie; see comments in the stub functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically gettext.install gettext.translation -hmac.new # Stub is a white lie; see comments in the stub importlib.abc.Finder.find_module inspect.Signature.from_builtin # Removed in 3.11, can add if someone needs this inspect.Signature.from_function # Removed in 3.11, can add if someone needs this -ipaddress.IPv4Interface.hostmask -ipaddress.IPv6Interface.hostmask -ipaddress._BaseNetwork.broadcast_address -ipaddress._BaseNetwork.hostmask -multiprocessing.spawn._main -pickle.Pickler.reducer_override # implemented in C pickler # platform.uname_result's processor field is now dynamically made to exist platform.uname_result.__new__ platform.uname_result._fields platform.uname_result.processor sched.Event.__doc__ # __slots__ is overridden -sys.UnraisableHookArgs # Not exported from sys tkinter.Tk.split -types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime types.GenericAlias.__getattr__ types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392 weakref.ProxyType.__reversed__ # Doesn't really exist -weakref.WeakValueDictionary.update typing_extensions\.get_original_bases # Exist at runtime for internal reasons, no need to put them in the stub @@ -98,12 +70,6 @@ collections.MappingView.__class_getitem__ hmac.HMAC.digest_cons hmac.HMAC.inner hmac.HMAC.outer -multiprocessing.managers.SharedMemoryServer.create -multiprocessing.managers.SharedMemoryServer.list_segments -multiprocessing.managers.SharedMemoryServer.public -multiprocessing.managers.SharedMemoryServer.release_segment -multiprocessing.managers.SharedMemoryServer.shutdown -multiprocessing.managers.SharedMemoryServer.track_segment types.GenericAlias.__mro_entries__ typing._SpecialForm.__mro_entries__ @@ -142,17 +108,11 @@ collections.Set.__rxor__ builtins.memoryview.__iter__ # C type that implements __getitem__ builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only -# C signature is broader than what is actually accepted -queue.SimpleQueue.__init__ -xml.etree.ElementTree.XMLParser.__init__ -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 # Runtime signature is incorrect (https://github.com/python/cpython/issues/93021) @@ -173,7 +133,6 @@ typing_extensions\.assert_type typing_extensions\.reveal_type # Super-special typing primitives -typing_extensions\.Final typing\.NamedTuple typing\.Annotated @@ -190,6 +149,3 @@ asynchat.async_chat.use_encoding asynchat.find_prefix_at_end pkgutil.ImpImporter\..* pkgutil.ImpLoader\..* - -# Omit internal _KEEP argument -tarfile.TarInfo.replace diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index 223a350bcba4..fafe75da5c78 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -4,9 +4,25 @@ # Please keep sorted alphabetically +_collections_abc.AsyncGenerator.ag_await +_collections_abc.AsyncGenerator.ag_code +_collections_abc.AsyncGenerator.ag_frame +_collections_abc.AsyncGenerator.ag_running +_collections_abc.ItemsView.__reversed__ +_collections_abc.KeysView.__reversed__ +_collections_abc.ValuesView.__reversed__ _csv.Dialect.__init__ # C __init__ signature is inaccurate _ctypes.CFuncPtr # stubtest erroneously thinks it can't be subclassed _threading_local.local.__new__ +ast.Bytes.__new__ +ast.Ellipsis.__new__ +ast.NameConstant.__new__ +ast.Num.__new__ +ast.Str.__new__ +asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them +asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them +asyncio.Future.__init__ # Usually initialized from c object +asyncio.futures.Future.__init__ # Usually initialized from c object builtins.dict.get builtins.ellipsis # type is not exposed anywhere builtins.function @@ -24,6 +40,10 @@ ctypes.memmove # CFunctionType ctypes.memset # CFunctionType ctypes.string_at # docstring argument name is wrong ctypes.wstring_at # docstring argument name is wrong +fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve +ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154 +functools.cached_property.__set__ # Stub is a white lie; see comments in the stub +hmac.new # Stub is a white lie; see comments in the stub http.HTTPStatus.description # set in __new__ http.HTTPStatus.phrase # set in __new__ http.client.HTTPConnection.response_class # the actual type at runtime is abc.ABCMeta @@ -44,6 +64,10 @@ io.FileIO.seek io.StringIO.seek io.StringIO.truncate io.TextIOWrapper.truncate +ipaddress.IPv4Interface.hostmask +ipaddress.IPv6Interface.hostmask +ipaddress._BaseNetwork.broadcast_address +ipaddress._BaseNetwork.hostmask ipaddress._BaseAddress.is_global ipaddress._BaseAddress.is_link_local ipaddress._BaseAddress.is_loopback @@ -74,6 +98,7 @@ multiprocessing.managers.SyncManager.RLock multiprocessing.queues.JoinableQueue.__init__ multiprocessing.queues.Queue.__init__ multiprocessing.queues.SimpleQueue.__init__ +multiprocessing.spawn._main multiprocessing.synchronize.Barrier.__init__ multiprocessing.synchronize.Condition.acquire multiprocessing.synchronize.Condition.release @@ -82,6 +107,7 @@ multiprocessing.synchronize.SemLock.acquire multiprocessing.synchronize.SemLock.release numbers.Number.__hash__ # typeshed marks this as abstract but code just sets this as None optparse.Values.__getattr__ # Some attributes are set in __init__ using setattr +pickle.Pickler.reducer_override # implemented in C pickler poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi pyexpat.expat_CAPI select.poll # Depends on configuration @@ -91,6 +117,7 @@ socketserver.BaseServer.fileno # implemented in derived classes socketserver.BaseServer.get_request # implemented in derived classes socketserver.BaseServer.server_bind # implemented in derived classes ssl.Purpose.__new__ # the multiple inheritance confuses mypy +sys.UnraisableHookArgs # Not exported from sys tarfile.TarFile.errors # errors is initialized for some reason as None even though it really only accepts str tkinter.simpledialog.[A-Z_]+ tkinter.simpledialog.TclVersion @@ -106,6 +133,9 @@ urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to weakref.WeakKeyDictionary.get weakref.WeakKeyDictionary.update weakref.WeakValueDictionary.get +weakref.WeakValueDictionary.update +xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signature +xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature xml.parsers.expat.expat_CAPI # ========== @@ -151,6 +181,12 @@ multiprocessing.managers.Server.number_of_objects multiprocessing.managers.Server.public multiprocessing.managers.Server.serve_client multiprocessing.managers.Server.shutdown +multiprocessing.managers.SharedMemoryServer.create +multiprocessing.managers.SharedMemoryServer.list_segments +multiprocessing.managers.SharedMemoryServer.public +multiprocessing.managers.SharedMemoryServer.release_segment +multiprocessing.managers.SharedMemoryServer.shutdown +multiprocessing.managers.SharedMemoryServer.track_segment multiprocessing.managers.SyncManager.Barrier multiprocessing.managers.SyncManager.JoinableQueue multiprocessing.managers.SyncManager.Pool @@ -364,6 +400,9 @@ multiprocessing.(dummy|managers).Namespace.__[gs]etattr__ # Any field can be se # but stubtest infers the runtime type as multiprocessing.reduction.AbstractReducer.ForkingPickler +# C signature is broader than what is actually accepted +queue.SimpleQueue.__init__ + # Items that depend on the existence and flags of SSL imaplib.IMAP4_SSL.ssl ssl.PROTOCOL_SSLv2 @@ -390,6 +429,7 @@ typing_extensions\._TypedDict\..* # Special primitives typing_extensions\.Annotated +typing_extensions\.Final typing_extensions\.NamedTuple typing_extensions\.LiteralString typing_extensions\.Coroutine @@ -620,3 +660,8 @@ typing(_extensions)?\.IO\.__iter__ # See https://github.com/python/typeshed/com (tarfile.AbsolutePathError)? (tarfile.AbsoluteLinkError)? (shutil.unpack_archive)? + +# Omit internal _KEEP argument +tarfile.TarInfo.replace + +types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime From a90ce7cdbd71bd8cb56a8740c55bcbf12eea3ab6 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Wed, 16 Aug 2023 23:43:15 +0100 Subject: [PATCH 2/3] Round two --- tests/stubtest_allowlists/py311.txt | 3 --- tests/stubtest_allowlists/py38.txt | 3 --- tests/stubtest_allowlists/py3_common.txt | 4 ---- tests/stubtest_allowlists/win32-py310.txt | 11 +---------- tests/stubtest_allowlists/win32-py311.txt | 11 +---------- tests/stubtest_allowlists/win32-py312.txt | 9 --------- tests/stubtest_allowlists/win32-py38.txt | 11 ----------- tests/stubtest_allowlists/win32-py39.txt | 11 ----------- tests/stubtest_allowlists/win32.txt | 9 +++++++++ 9 files changed, 11 insertions(+), 61 deletions(-) diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 35eef14b8834..f903121a93f6 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -123,6 +123,3 @@ asynchat.async_chat.use_encoding asynchat.find_prefix_at_end pkgutil.ImpImporter\..* pkgutil.ImpLoader\..* - -# Omit internal _KEEP argument -tarfile.TarInfo.replace diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index d76c7c15989d..1662f25db2aa 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -145,9 +145,6 @@ typing_extensions\.assert_never typing_extensions\.assert_type typing_extensions\.reveal_type -# Super-special typing primitives -typing_extensions\.Final - # We lie about the existence of these methods .*.__buffer__ .*.__release_buffer__ diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index fafe75da5c78..a0f3d786c4b2 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -357,10 +357,6 @@ csv.Dialect.skipinitialspace csv.DictReader.__init__ # runtime sig has *args but will error if more than 5 positional args are supplied csv.DictWriter.__init__ # runtime sig has *args but will error if more than 5 positional args are supplied -# Removed undocumented and often mistakenly used _normalize parameter that was removed in 3.12 -# On 3.12, stubtest doesn't correctly combine the overload because parameter names mismatch -fractions.Fraction.__new__ - contextvars.Context.__init__ # C signature is broader than what is actually accepted dataclasses.field # White lies around defaults hashlib.sha3_\d+ # Can be a class or a built-in function, can't be subclassed at runtime diff --git a/tests/stubtest_allowlists/win32-py310.txt b/tests/stubtest_allowlists/win32-py310.txt index e62c9f69670a..571903faaf2f 100644 --- a/tests/stubtest_allowlists/win32-py310.txt +++ b/tests/stubtest_allowlists/win32-py310.txt @@ -1,14 +1,5 @@ -# Exists at runtime, but missing from stubs -_winapi.CreateFileMapping -_winapi.MapViewOfFile -_winapi.OpenFileMapping -_winapi.VirtualQuerySize -asyncio.IocpProactor.recvfrom -asyncio.IocpProactor.sendto -asyncio.windows_events.IocpProactor.recvfrom -asyncio.windows_events.IocpProactor.sendto +# Exists at runtime, missing from the stubs msvcrt.GetErrorMode -subprocess.STARTUPINFO.copy # pathlib methods that exist on Windows, but always raise NotImplementedError, # so are omitted from the stub diff --git a/tests/stubtest_allowlists/win32-py311.txt b/tests/stubtest_allowlists/win32-py311.txt index f3eb72c32e2a..4721e015dbe8 100644 --- a/tests/stubtest_allowlists/win32-py311.txt +++ b/tests/stubtest_allowlists/win32-py311.txt @@ -1,17 +1,8 @@ - -_winapi.CreateFileMapping -_winapi.MapViewOfFile -_winapi.OpenFileMapping -_winapi.VirtualQuerySize -asyncio.IocpProactor.recvfrom +# Exists at runtime, missing from the stubs asyncio.IocpProactor.recvfrom_into -asyncio.IocpProactor.sendto -asyncio.windows_events.IocpProactor.recvfrom asyncio.windows_events.IocpProactor.recvfrom_into -asyncio.windows_events.IocpProactor.sendto msvcrt.GetErrorMode os.EX_OK -subprocess.STARTUPINFO.copy # pathlib methods that exist on Windows, but always raise NotImplementedError, # so are omitted from the stub diff --git a/tests/stubtest_allowlists/win32-py312.txt b/tests/stubtest_allowlists/win32-py312.txt index 7b0f3a96fe4c..2012b686baba 100644 --- a/tests/stubtest_allowlists/win32-py312.txt +++ b/tests/stubtest_allowlists/win32-py312.txt @@ -1,16 +1,8 @@ -_winapi.CreateFileMapping -_winapi.MapViewOfFile _winapi.NeedCurrentDirectoryForExePath -_winapi.OpenFileMapping -_winapi.VirtualQuerySize asyncio.IocpProactor.finish_socket_func -asyncio.IocpProactor.recvfrom asyncio.IocpProactor.recvfrom_into -asyncio.IocpProactor.sendto asyncio.windows_events.IocpProactor.finish_socket_func -asyncio.windows_events.IocpProactor.recvfrom asyncio.windows_events.IocpProactor.recvfrom_into -asyncio.windows_events.IocpProactor.sendto msvcrt.GetErrorMode ntpath.isdir os.EX_OK @@ -22,4 +14,3 @@ os.path.isdir os.set_blocking os.stat_result.st_birthtime os.stat_result.st_birthtime_ns -subprocess.STARTUPINFO.copy diff --git a/tests/stubtest_allowlists/win32-py38.txt b/tests/stubtest_allowlists/win32-py38.txt index 49369652991b..ebef7f45573d 100644 --- a/tests/stubtest_allowlists/win32-py38.txt +++ b/tests/stubtest_allowlists/win32-py38.txt @@ -1,14 +1,3 @@ -# Exists at runtime, but missing from stubs -_winapi.CreateFileMapping -_winapi.MapViewOfFile -_winapi.OpenFileMapping -_winapi.VirtualQuerySize -asyncio.IocpProactor.recvfrom -asyncio.IocpProactor.sendto -asyncio.windows_events.IocpProactor.recvfrom -asyncio.windows_events.IocpProactor.sendto -subprocess.STARTUPINFO.copy - # ========== # Allowlist entries that cannot or should not be fixed # ========== diff --git a/tests/stubtest_allowlists/win32-py39.txt b/tests/stubtest_allowlists/win32-py39.txt index f61f8653c6ad..f41da5612269 100644 --- a/tests/stubtest_allowlists/win32-py39.txt +++ b/tests/stubtest_allowlists/win32-py39.txt @@ -1,14 +1,3 @@ -# Exists at runtime, but missing from stubs -_winapi.CreateFileMapping -_winapi.MapViewOfFile -_winapi.OpenFileMapping -_winapi.VirtualQuerySize -asyncio.IocpProactor.recvfrom -asyncio.IocpProactor.sendto -asyncio.windows_events.IocpProactor.recvfrom -asyncio.windows_events.IocpProactor.sendto -subprocess.STARTUPINFO.copy - # pathlib methods that exist on Windows, but always raise NotImplementedError, # so are omitted from the stub pathlib.Path.is_mount diff --git a/tests/stubtest_allowlists/win32.txt b/tests/stubtest_allowlists/win32.txt index 417f227d24d9..e0f9d4d76fe9 100644 --- a/tests/stubtest_allowlists/win32.txt +++ b/tests/stubtest_allowlists/win32.txt @@ -14,10 +14,19 @@ winsound.SND_APPLICATION # Exists at runtime, but missing from stubs _msi.MSIError +_winapi.CreateFileMapping +_winapi.MapViewOfFile +_winapi.OpenFileMapping +_winapi.VirtualQuerySize +asyncio.IocpProactor.recvfrom +asyncio.IocpProactor.sendto +asyncio.windows_events.IocpProactor.recvfrom +asyncio.windows_events.IocpProactor.sendto msvcrt.SetErrorMode ssl.SSLSocket.recvmsg ssl.SSLSocket.recvmsg_into ssl.SSLSocket.sendmsg +subprocess.STARTUPINFO.copy winreg.HKEYType.handle _ctypes.FreeLibrary _ctypes.LoadLibrary From a7643054e1ae6619e51b22a27f5a8d554bbfb247 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 16 Aug 2023 23:55:22 +0100 Subject: [PATCH 3/3] Update tests/stubtest_allowlists/win32-py310.txt --- tests/stubtest_allowlists/win32-py310.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/stubtest_allowlists/win32-py310.txt b/tests/stubtest_allowlists/win32-py310.txt index 571903faaf2f..8a751827e088 100644 --- a/tests/stubtest_allowlists/win32-py310.txt +++ b/tests/stubtest_allowlists/win32-py310.txt @@ -1,4 +1,4 @@ -# Exists at runtime, missing from the stubs +# Exists at runtime, but missing from stubs msvcrt.GetErrorMode # pathlib methods that exist on Windows, but always raise NotImplementedError,