Skip to content

Deduplicate stdlib stubtest allowlist entries #10594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 1 addition & 42 deletions tests/stubtest_allowlists/py310.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,28 @@
_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
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -181,7 +144,6 @@ typing_extensions\.reveal_type
typing.NewType.__call__

# Super-special typing primitives
typing_extensions\.Final
typing\.NamedTuple
typing\.Annotated

Expand All @@ -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
43 changes: 0 additions & 43 deletions tests/stubtest_allowlists/py311.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -134,7 +95,6 @@ unittest.case.TestCase.__init_subclass__

# Super-special typing primitives
typing\._SpecialForm.*
typing_extensions\.Final
typing\.NamedTuple
typing\.LiteralString
typing\.Annotated
Expand Down Expand Up @@ -163,6 +123,3 @@ asynchat.async_chat.use_encoding
asynchat.find_prefix_at_end
pkgutil.ImpImporter\..*
pkgutil.ImpLoader\..*

# Omit internal _KEEP argument
tarfile.TarInfo.replace
43 changes: 0 additions & 43 deletions tests/stubtest_allowlists/py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
47 changes: 0 additions & 47 deletions tests/stubtest_allowlists/py38.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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__
Expand All @@ -186,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__
Expand All @@ -202,6 +158,3 @@ asynchat.async_chat.use_encoding
asynchat.find_prefix_at_end
pkgutil.ImpImporter\..*
pkgutil.ImpLoader\..*

# Omit internal _KEEP argument
tarfile.TarInfo.replace
Loading