Move stdlib allowlists to stdlib/@tests (#11982)

Rename py3_common.txt to common.txt
This commit is contained in:
Sebastian Rittau
2024-05-20 13:23:02 +02:00
committed by GitHub
parent 3cb7451c99
commit e2e3750ee9
23 changed files with 6 additions and 6 deletions

View File

@@ -0,0 +1,726 @@
# ==========
# Allowlist entries that should be fixed
# ==========
# 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
collections\.ChainMap\.fromkeys # https://github.com/python/mypy/issues/17023
collections\.UserList\.sort # Runtime has *args but will error if any are supplied
configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used
# SectionProxy get functions are set in __init__
configparser.SectionProxy.getboolean
configparser.SectionProxy.getfloat
configparser.SectionProxy.getint
copy.PyStringMap # defined only in Jython
ctypes.CDLL._FuncPtr # None at class level but initialized in __init__ to this value
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
importlib.abc.FileLoader.get_filename # Wrapped with _check_name decorator which changes runtime signature
importlib.abc.FileLoader.load_module # Wrapped with _check_name decorator which changes runtime signature
importlib.abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
importlib.abc.MetaPathFinder.find_spec # Not defined on the actual class, but expected to exist.
importlib.abc.PathEntryFinder.find_spec # Not defined on the actual class, but expected to exist.
importlib.machinery.ExtensionFileLoader.get_filename # Wrapped with _check_name decorator which changes runtime signature
io.BufferedRandom.truncate
io.BufferedReader.seek
io.BufferedReader.truncate
io.BufferedWriter.seek
io.BufferedWriter.truncate
io.BytesIO.readlines
io.BytesIO.seek # Parameter name for a positional-only param differs from its name in the inherited method
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
ipaddress._BaseAddress.is_multicast
ipaddress._BaseAddress.is_private
ipaddress._BaseAddress.is_reserved
ipaddress._BaseAddress.is_unspecified
ipaddress._BaseAddress.max_prefixlen
ipaddress._BaseAddress.packed
ipaddress._BaseNetwork.max_prefixlen
lib2to3.pygram.pattern_symbols
lib2to3.pygram.python_symbols
lib2to3.pytree.Base.__new__
lib2to3.pytree.Base.children
lib2to3.pytree.Base.type
lib2to3.pytree.BasePattern.__new__
lib2to3.pytree.BasePattern.type
lib2to3.pytree.NegatedPattern.match
lib2to3.pytree.NegatedPattern.match_seq
multiprocessing.JoinableQueue
multiprocessing.Queue
multiprocessing.SimpleQueue
multiprocessing.managers.BaseManager.shutdown
multiprocessing.managers.SyncManager.Event
multiprocessing.managers.SyncManager.Lock
multiprocessing.managers.SyncManager.Namespace
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
multiprocessing.synchronize.SemLock.__init__
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
pyexpat.expat_CAPI
select.poll # Depends on configuration
selectors.DevpollSelector # Depends on configuration
shutil.rmtree # stubtest doesn't like that we have this as an instance of a callback protocol instead of a function
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
tkinter.simpledialog.TkVersion
tkinter.tix.[A-Z_]+
tkinter.tix.TclVersion
tkinter.tix.TkVersion
tkinter.Misc.after # we intentionally don't allow everything that "works" at runtime
traceback.TracebackException.from_exception # explicitly expanding arguments going into TracebackException __init__
typing(_extensions)?\.IO\.__next__ # Added because IO streams are iterable. See https://github.com/python/typeshed/commit/97bc450acd60c1bcdafef3ce8fbe3b95a9c0cac3
typing.type_check_only # typing decorator that is not available at runtime
unittest.mock.patch # It's a complicated overload and I haven't been able to figure out why stubtest doesn't like it
urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to super, so super args are specified
weakref.WeakKeyDictionary.update
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
# Modules that exist at runtime, but shouldn't be added to typeshed
idlelib
# ==========
# Modules that exist at runtime, but are missing from stubs
# ==========
ctypes.macholib
ctypes.macholib.dyld
ctypes.macholib.dylib
ctypes.macholib.framework
encodings.aliases
encodings.ascii
encodings.base64_codec
encodings.big5
encodings.big5hkscs
encodings.bz2_codec
encodings.charmap
encodings\.cp\d+
encodings\.euc_.+
encodings.gb18030
encodings.gb2312
encodings.gbk
encodings.hex_codec
encodings.hp_roman8
encodings.hz
encodings.idna
encodings\.iso2022_.*
encodings\.iso8859_\d+
encodings.johab
encodings\.koi8_\w
encodings.kz1048
encodings.latin_1
encodings\.mac_.+
encodings.palmos
encodings.ptcp154
encodings.punycode
encodings.quopri_codec
encodings.raw_unicode_escape
encodings.rot_13
encodings\.shift_jis.*
encodings.tis_620
encodings.undefined
encodings.unicode_escape
encodings.utf_16
encodings.utf_16_be
encodings.utf_16_le
encodings.utf_32
encodings.utf_32_be
encodings.utf_32_le
encodings.utf_7
encodings.uu_codec
encodings.zlib_codec
json.scanner
lib2to3.btm_utils
lib2to3.fixer_util
lib2to3.patcomp
sqlite3.dump
turtledemo
turtledemo\..+
xml.sax.expatreader
# ==========
# Module members that exist at runtime, but are missing from stubs
# ==========
_json.encode_basestring
_thread.LockType.acquire_lock
_thread.LockType.locked_lock
_thread.LockType.release_lock
_thread.RLock
_thread.allocate
_thread.exit_thread
_thread.start_new
_threading_local._localimpl.localargs
_threading_local._localimpl.locallock
builtins.SyntaxError.print_file_and_line
bz2.BZ2File.peek
codecs.StreamReader.charbuffertype
codecs.StreamReader.seek
codecs.StreamWriter.seek
configparser.RawConfigParser.converters
ctypes.ARRAY
ctypes.SetPointerType
ctypes.c_voidp
ctypes.util.test
lib2to3.pgen2.grammar.Grammar.loads
mimetypes.MimeTypes.add_type
modulefinder.test
multiprocessing.managers.Server.accepter
multiprocessing.managers.Server.create
multiprocessing.managers.Server.debug_info
multiprocessing.managers.Server.decref
multiprocessing.managers.Server.dummy
multiprocessing.managers.Server.fallback_getvalue
multiprocessing.managers.Server.fallback_mapping
multiprocessing.managers.Server.fallback_repr
multiprocessing.managers.Server.fallback_str
multiprocessing.managers.Server.get_methods
multiprocessing.managers.Server.handle_request
multiprocessing.managers.Server.incref
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
multiprocessing.pool.Pool.Process
multiprocessing.pool.ThreadPool.Process
multiprocessing.synchronize.Semaphore.get_value
tkinter.Misc.config
tkinter.font.Font.counter
tkinter.tix.CObjView
tkinter.tix.DialogShell
tkinter.tix.ExFileSelectDialog
tkinter.tix.FileSelectDialog
tkinter.tix.FileTypeList
tkinter.tix.Grid
tkinter.tix.NoteBookFrame
tkinter.tix.OptionName
tkinter.tix.ResizeHandle
tkinter.tix.ScrolledGrid
tkinter.tix.ScrolledHList
tkinter.tix.ScrolledListBox
tkinter.tix.ScrolledTList
tkinter.tix.ScrolledText
tkinter.tix.ScrolledWindow
tkinter.tix.Shell
turtle.TNavigator.speed
# Undocumented implementation details of a deprecated class
importlib.machinery.WindowsRegistryFinder.DEBUG_BUILD
importlib.machinery.WindowsRegistryFinder.REGISTRY_KEY
importlib.machinery.WindowsRegistryFinder.REGISTRY_KEY_DEBUG
# Undocumented implementation details
profile.Profile.dispatch
profile.Profile.fake_code
profile.Profile.fake_frame
profile.Profile.trace_dispatch
profile.Profile.trace_dispatch_c_call
profile.Profile.trace_dispatch_call
profile.Profile.trace_dispatch_exception
profile.Profile.trace_dispatch_i
profile.Profile.trace_dispatch_l
profile.Profile.trace_dispatch_mac
profile.Profile.trace_dispatch_return
cgi.FieldStorage.bufsize
cgi.FieldStorage.read_binary
cgi.FieldStorage.read_lines
cgi.FieldStorage.read_lines_to_eof
cgi.FieldStorage.read_lines_to_outerboundary
cgi.FieldStorage.read_multi
cgi.FieldStorage.read_single
cgi.FieldStorage.read_urlencoded
cgi.FieldStorage.skip_lines
email.contentmanager.get_and_fixup_unknown_message_content
email.contentmanager.get_message_content
email.contentmanager.get_non_text_content
email.contentmanager.get_text_content
email.contentmanager.set_bytes_content
email.contentmanager.set_message_content
email.contentmanager.set_text_content
pipes.Template.makepipeline
pipes.Template.open_r
pipes.Template.open_w
sunau.Au_read.initfp
sunau.Au_write.initfp
turtle.ScrolledCanvas.adjustScrolls
turtle.ScrolledCanvas.onResize
wave.Wave_read.initfp
wave.Wave_write.initfp
_ctypes.PyObj_FromPtr
_ctypes.Py_DECREF
_ctypes.Py_INCREF
_ctypes.buffer_info
_ctypes.call_cdeclfunction
_ctypes.call_function
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Runtime AST node runtime constructor behaviour is too loose.
# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378).
# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858)
_?ast.AST.__init__
_?ast.excepthandler.__init__
_?ast.expr.__init__
_?ast.stmt.__init__
# async at runtime, deliberately not in the stub, see #7491
_collections_abc.AsyncGenerator.asend # pos-only differences also.
_collections_abc.AsyncGenerator.__anext__
_collections_abc.AsyncGenerator.aclose
_collections_abc.AsyncIterator.__anext__
# Coroutine and Generator properties are added programmatically
_collections_abc.Coroutine.cr_await
_collections_abc.Coroutine.cr_code
_collections_abc.Coroutine.cr_frame
_collections_abc.Coroutine.cr_running
_collections_abc.Generator.gi_code
_collections_abc.Generator.gi_frame
_collections_abc.Generator.gi_running
_collections_abc.Generator.gi_yieldfrom
_collections_abc.Mapping.__reversed__ # set to None at runtime for a better error message
_collections_abc.Mapping.get # Adding None to the Union messed up mypy
_collections_abc.Sequence.index # Supporting None in end is not mandatory
# Adding these reflected dunders to `typing.AbstractSet` causes a large number of false-positives. See #7414.
_collections_abc.Set.__rand__
_collections_abc.Set.__ror__
_collections_abc.Set.__rsub__
_collections_abc.Set.__rxor__
collections.abc.* # Types are re-exported from _collections_abc, so errors should be fixed there
_?ctypes.Array.raw # exists but stubtest can't see it; only available if _CT == c_char
_?ctypes.Array._type_ # _type_ is abstract, https://github.com/python/typeshed/pull/6361
_?ctypes.Array._length_ # _length_ is abstract, https://github.com/python/typeshed/pull/6361
_pydecimal.* # See comments in file
argparse.ArgumentParser.__init__ # stubtest doesn't recognise the runtime default (a class) as being compatible with a callback protocol (the stub annotation)
argparse.Namespace.__getattr__ # The whole point of this class is its attributes are dynamic
ast.NodeVisitor.visit_\w+ # Methods are discovered dynamically, see #3796
asyncio.proactor_events.BaseProactorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation
asyncio.selector_events.BaseSelectorEventLoop.sock_recv # nbytes parameter has different name 'n' in implementation
# Condition functions are exported in __init__
asyncio.Condition.acquire
asyncio.Condition.locked
asyncio.Condition.release
asyncio.locks.Condition.acquire
asyncio.locks.Condition.locked
asyncio.locks.Condition.release
threading.Condition.acquire
threading.Condition.release
multiprocessing.dummy.Condition.acquire
multiprocessing.dummy.Condition.release
# Weird special builtins that are typed as functions, but aren't functions
builtins.copyright
builtins.credits
builtins.exit
builtins.help
builtins.license
builtins.quit
builtins.float.__getformat__ # Internal method for CPython test suite
builtins.memoryview.__contains__ # C type that implements __getitem__
builtins.object.__init__ # default C signature is incorrect
builtins.OSError.characters_written # GetSetDescriptor that always raises AttributeError
builtins.reveal_locals # Builtins that type checkers pretends exist
builtins.reveal_type # Builtins that type checkers pretends exist
builtins.type.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute.
# These super() dunders don't seem to be particularly useful,
# and having them pop up on autocomplete suggestions would be annoying
builtins.super.__self__
builtins.super.__self_class__
builtins.super.__thisclass__
# The following CodecInfo properties are added in __new__
codecs.CodecInfo.decode
codecs.CodecInfo.encode
codecs.CodecInfo.incrementaldecoder
codecs.CodecInfo.incrementalencoder
codecs.CodecInfo.streamreader
codecs.CodecInfo.streamwriter
# The Dialect properties are initialized as None in Dialect but their values are enforced in _Dialect
csv.Dialect.delimiter
csv.Dialect.doublequote
csv.Dialect.lineterminator
csv.Dialect.quoting
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
contextvars.Context.__init__ # C signature is broader than what is actually accepted
dataclasses.field # White lies around defaults
hashlib.scrypt # Raises TypeError if salt, n, r or p are None
hashlib.sha3_\d+ # Can be a class or a built-in function, can't be subclassed at runtime
hashlib.shake_\d+ # Can be a class or a built-in function, can't be subclassed at runtime
hmac.HMAC.blocksize # use block_size instead
# We can't distinguish not having a default value from having a default value of inspect.Parameter.empty
inspect.Parameter.__init__
inspect.Signature.__init__
inspect.Parameter.empty # set as private marker _empty
inspect.Signature.empty # set as private marker _empty
# These multiprocessing proxy methods have *args, **kwargs signatures at runtime,
# But have more precise (accurate) signatures in the stub
multiprocessing.managers.BaseListProxy.__imul__
multiprocessing.managers.BaseListProxy.__len__
multiprocessing.managers.BaseListProxy.__reversed__
multiprocessing.managers.BaseListProxy.reverse
multiprocessing.managers.BaseListProxy.sort
multiprocessing.managers.DictProxy.__iter__
multiprocessing.managers.DictProxy.__len__
multiprocessing.managers.DictProxy.clear
multiprocessing.managers.DictProxy.copy
multiprocessing.managers.DictProxy.items
multiprocessing.managers.DictProxy.keys
multiprocessing.managers.DictProxy.popitem
multiprocessing.managers.DictProxy.values
multiprocessing.(dummy|managers).Namespace.__[gs]etattr__ # Any field can be set on Namespace
# alias for a class defined elsewhere,
# mypy infers the variable has type `(*args) -> ForkingPickler`
# but stubtest infers the runtime type as <class ForkingPickler>
multiprocessing.reduction.AbstractReducer.ForkingPickler
# Non-private parameter on __del__
multiprocessing.pool.Pool.__del__
# 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
ssl.PROTOCOL_SSLv3
ssl.RAND_egd
pickle._Pickler\..* # Best effort typing for undocumented internals
pickle._Unpickler\..* # Best effort typing for undocumented internals
pickle.Pickler.memo # undocumented implementation detail, has different type in C/Python implementations
pickle.Pickler.persistent_id # C pickler persistent_id is an attribute
pickle.Unpickler.memo # undocumented implementation detail, has different type in C/Python implementations
pickle.Unpickler.persistent_load # C unpickler persistent_load is an attribute
re.Pattern.scanner # Undocumented and not useful. #6405
tempfile._TemporaryFileWrapper.[\w_]+ # Dynamically specified by __getattr__, and thus don't exist on the class
# Details of runtime definition don't need to be in stubs
typing_extensions\._SpecialForm.*
typing_extensions\.TypeVar.*
typing_extensions\.ParamSpec.*
typing(_extensions)?\.Generic
typing\.Protocol
typing(_extensions)?\._TypedDict
# Special primitives
typing_extensions\.Annotated
typing_extensions\.Final
typing_extensions\.NamedTuple
typing_extensions\.LiteralString
typing_extensions\.Coroutine
typing_extensions\.Awaitable
typing(_extensions)?\.AsyncIterator
typing(_extensions)?\.AsyncIterable
typing(_extensions)?\.AsyncGenerator
typing(_extensions)?\.ValuesView
typing(_extensions)?\.Sized
typing(_extensions)?\.Sequence
typing(_extensions)?\.Reversible
typing(_extensions)?\.Pattern
typing(_extensions)?\.MutableSet
typing(_extensions)?\.MutableSequence
typing(_extensions)?\.MutableMapping
typing(_extensions)?\.Match
typing(_extensions)?\.MappingView
typing(_extensions)?\.Mapping
typing(_extensions)?\.KeysView
typing(_extensions)?\.Iterator
typing(_extensions)?\.Iterable
typing(_extensions)?\.ItemsView
typing(_extensions)?\.Hashable
typing(_extensions)?\.Generator
typing(_extensions)?\.Coroutine
typing(_extensions)?\.Collection
typing(_extensions)?\.Container
typing\.ByteString
typing(_extensions)?\.Awaitable
typing(_extensions)?\.AbstractSet
typing_extensions.NewType.__mro_entries__ # just exists for an error message
# Typing-related weirdness
_collections_abc.Callable
_typeshed.* # Utility types for typeshed, doesn't exist at runtime
typing._SpecialForm.__call__
typing._SpecialForm.__init__
# Pretend typing.ByteString is a Union, to better match its documented semantics.
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
# because it's not an ABC that makes any sense and was deprecated in 3.12
_collections_abc.ByteString
# These are abstract properties at runtime,
# but marking them as such in the stub breaks half the the typed-Python ecosystem (see #8726)
typing(_extensions)?\.IO\.closed
typing(_extensions)?\.IO\.mode
typing(_extensions)?\.IO\.name
typing(_extensions)?\.TextIO\.buffer
typing(_extensions)?\.TextIO\.encoding
typing(_extensions)?\.TextIO\.errors
typing(_extensions)?\.TextIO\.line_buffering
typing(_extensions)?\.TextIO\.newlines
# These are typing._SpecialGenericAlias at runtime, which is not a real type, but it
# behaves like one in most cases
typing(_extensions)?\.(Async)?ContextManager
types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.
types.ModuleType.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute.
types.ModuleType.__getattr__ # this doesn't exist at runtime
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
# sys attributes that are not always defined
sys.gettotalrefcount # Available on python debug builds
sys.last_traceback
sys.last_type
sys.last_value
sys.ps1
sys.ps2
sys.tracebacklimit
sys.implementation # Actually SimpleNamespace but then you wouldn't have convenient attributes
# A factory function that returns 'most efficient lock'.
# Marking it as a function will make it impossible for users to use the Lock type as an annotation.
threading.Lock
threading.RLock
multiprocessing.dummy.Lock
multiprocessing.dummy.RLock
# Dynamically created, has unnecessary *args
turtle.ScrolledCanvas.find_all
turtle.ScrolledCanvas.select_clear
turtle.ScrolledCanvas.select_item
# Attributes that are intended to be private
uuid.bytes_
uuid.int_
# Always overridden in inheriting class
webbrowser.UnixBrowser.remote_action
webbrowser.UnixBrowser.remote_action_newtab
webbrowser.UnixBrowser.remote_action_newwin
# Undocumented and have a comment in the source code saying "State variables (don't mess with these)"
wsgiref.handlers.BaseHandler.bytes_sent
wsgiref.handlers.BaseHandler.headers
wsgiref.handlers.BaseHandler.headers_sent
wsgiref.handlers.BaseHandler.result
wsgiref.handlers.BaseHandler.status
(_?weakref.ref|_?weakref.ReferenceType).__call__ # C function default annotation is wrong
(_?weakref.ref|_?weakref.ReferenceType).__init__ # Runtime defines __new__ but stubtest thinks __init__ is also defined.
_?weakref.CallableProxyType.__getattr__ # Should have all attributes of proxy
_?weakref.ProxyType.__bytes__ # Doesn't actually exist
_?weakref.ProxyType.__getattr__ # Should have all attributes of proxy
weakref.WeakValueDictionary.setdefault # has a default value for the "default" argument, but always errors out if no value is supplied for the parameter by the user
xml.dom.minidom.StringTypes # Unnecessary re-export
# See comments in file. List out methods that are delegated by __getattr__ at runtime.
# Used to make the relevant class satisfy BinaryIO interface.
codecs.StreamReaderWriter.\w+
codecs.StreamRecoder.\w+
urllib.response.addbase.\w+
# __all__-related weirdness (see #6523)
email.base64mime
email.charset
email.encoders
email.errors
email.feedparser
email.generator
email.header
email.iterators
email.message
email.mime
email.parser
email.quoprimime
email.utils
xml.dom
xml.etree
xml.sax
# Platform differences that cannot be captured by the type system
os.O_[A-Z_]+
socket.AF_DECnet
# Loadable SQLite extensions are disabled on GitHub runners
(sqlite3(.dbapi2)?.Connection.enable_load_extension)?
(sqlite3(.dbapi2)?.Connection.load_extension)?
# Missing aliases to existing methods that not many people seem to use.
# Complicated multiple inheritance, confuses type checkers.
tkinter.Grid.bbox
tkinter.Grid.columnconfigure
tkinter.Grid.config
tkinter.Grid.configure
tkinter.Grid.forget
tkinter.Grid.grid_bbox
tkinter.Grid.grid_columnconfigure
tkinter.Grid.grid_location
tkinter.Grid.grid_propagate
tkinter.Grid.grid_rowconfigure
tkinter.Grid.grid_size
tkinter.Grid.grid_slaves
tkinter.Grid.info
tkinter.Grid.propagate
tkinter.Grid.rowconfigure
tkinter.Grid.slaves
tkinter.Pack.config
tkinter.Pack.configure
tkinter.Pack.info
tkinter.Pack.pack_propagate
tkinter.Pack.pack_slaves
tkinter.Pack.slaves
tkinter.Place.config
tkinter.Place.configure
tkinter.Place.forget
tkinter.Place.place_slaves
tkinter.Place.slaves
# Methods that come from __getattr__() at runtime
tkinter.Tk.adderrorinfo
tkinter.Tk.call
tkinter.Tk.createcommand
tkinter.Tk.createtimerhandler
tkinter.Tk.dooneevent
tkinter.Tk.eval
tkinter.Tk.evalfile
tkinter.Tk.exprboolean
tkinter.Tk.exprdouble
tkinter.Tk.exprlong
tkinter.Tk.exprstring
tkinter.Tk.globalgetvar
tkinter.Tk.globalsetvar
tkinter.Tk.globalunsetvar
tkinter.Tk.interpaddr
tkinter.Tk.record
tkinter.Tk.splitlist
tkinter.Tk.unsetvar
tkinter.Tk.wantobjects
tkinter.Tk.willdispatch
tkinter.font.Font.__getitem__ # Argument name differs (doesn't matter for __dunder__ methods)
tkinter.Misc.grid_propagate # The noarg placeholder is a set value list
tkinter.Misc.pack_propagate # The noarg placeholder is a set value list
tkinter.Tk.report_callback_exception # A bit of a lie, since it's actually a method, but typing it as an attribute allows it to be assigned to
tkinter.Wm.wm_iconphoto # Default value of argument can't be used without runtime error
# Iterable classes that don't define __iter__ at runtime (usually iterable via __getitem__)
# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
_ctypes.Array.__iter__
ctypes.Array.__iter__
mmap.mmap.__iter__
mmap.mmap.__contains__
xml.etree.ElementTree.Element.__iter__
xml.etree.cElementTree.Element.__iter__
typing(_extensions)?\.IO\.__iter__ # See https://github.com/python/typeshed/commit/97bc450acd60c1bcdafef3ce8fbe3b95a9c0cac3
# LC_MESSAGES is sometimes present in __all__, sometimes not,
# so stubtest will sometimes complain about exported names being different at runtime to the exported names in the stub
(locale.__all__)?
# Added or modified in a patch release, backported to all security branches,
# but have yet to find their way to all GitHub Actions images
(tarfile.tar_filter)?
(tarfile.fully_trusted_filter)?
(tarfile.data_filter)?
(tarfile.TarFile.extractall)?
(tarfile.TarFile.extract)?
(tarfile.SpecialFileError)?
(tarfile.OutsideDestinationError)?
(tarfile.LinkOutsideDestinationError)?
(tarfile.FilterError)?
(tarfile.AbsolutePathError)?
(tarfile.AbsoluteLinkError)?
(shutil.unpack_archive)?
(pyexpat.XMLParserType.GetReparseDeferralEnabled)?
(pyexpat.XMLParserType.SetReparseDeferralEnabled)?
(xml.etree.ElementTree.XMLParser.flush)?
(xml.etree.ElementTree.XMLPullParser.flush)?
(xml.etree.cElementTree.XMLParser.flush)?
(xml.etree.cElementTree.XMLPullParser.flush)?
(xml.parsers.expat.XMLParserType.GetReparseDeferralEnabled)?
(xml.parsers.expat.XMLParserType.SetReparseDeferralEnabled)?

View File

@@ -0,0 +1,8 @@
# These entries looks like a `setup-python` bug:
(dbm.gnu)?
(_?locale.bind_textdomain_codeset)?
(_?locale.bindtextdomain)?
(_?locale.dcgettext)?
(_?locale.dgettext)?
(_?locale.gettext)?
(_?locale.textdomain)?

View File

@@ -0,0 +1,13 @@
# TODO: fix
_curses.unget_wch
_curses.window.get_wch
curses.window.get_wch
# These entries looks like a `setup-python` bug:
(dbm.gnu)?
(_?locale.bind_textdomain_codeset)?
(_?locale.bindtextdomain)?
(_?locale.dcgettext)?
(_?locale.dgettext)?
(_?locale.gettext)?
(_?locale.textdomain)?

View File

@@ -0,0 +1,67 @@
_posixsubprocess.cloexec_pipe
curses.has_key
(os|posix).sched_param # system dependent. Unclear if macos has it.
select.KQ_FILTER_NETDEV # system dependent
select.kqueue.__init__ # default C signature is wrong
select.POLLMSG # system dependent
# Sometimes these seem to exist on darwin, sometimes not
(_socket.MSG_NOSIGNAL)?
(socket.MsgFlag.MSG_NOSIGNAL)?
(socket.MSG_NOSIGNAL)?
(os.preadv)?
(os.pwritev)?
(posix.preadv)?
(posix.pwritev)?
(readline.append_history_file)?
(fcntl.F_GETLEASE)?
(fcntl.F_SETLEASE)?
# Platform differences that cannot be captured by the type system
(posix.O_[A-Z_]+)?
(posix.ST_[A-Z]+)?
(termios.[A-Z0-9_]+)?
# Exists at runtime, but missing from stubs
_ctypes.dlclose
_ctypes.dlopen
_ctypes.dlsym
webbrowser.MacOSX.__init__
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Modules that do not exist on macos systems
_msi
_winapi
asyncio.windows_events
asyncio.windows_utils
msilib(.[a-z]+)?
msvcrt
nt
winreg
winsound
ossaudiodev
spwd
# multiprocessing.popen_spawn_win32 exists on Darwin but fail to import
multiprocessing.popen_spawn_win32
# Platform differences that cannot be captured by the type system
os.SCHED_[A-Z_]+
posix.SCHED_[A-Z_]+
# Some of these exist on non-windows, but they are useless and this is not intended
stat.FILE_ATTRIBUTE_[A-Z_]+
# Methods that come from __getattr__() at runtime
tkinter.Tk.createfilehandler
tkinter.Tk.deletefilehandler
_?curses.ACS_.* # ACS codes are initialized only after initscr call
curses.COLORS # Initialized after start_color
curses.COLOR_PAIRS # Initialized after start_color
curses.COLS # Initialized only after initscr call
curses.LINES # Initialized only after initscr call

View File

@@ -0,0 +1,3 @@
# Exists on some Linux builds, and is documented,
# but is unavailable in Github Actions on Linux with Python 3.12
(os|posix).CLONE_NEWTIME

View File

@@ -0,0 +1 @@
select.epoll.register

View File

@@ -0,0 +1 @@
select.epoll.register

View File

@@ -0,0 +1,55 @@
_socket.*
_posixsubprocess.cloexec_pipe
curses.has_key
os.plock
selectors.KqueueSelector
socket.[A-Z0-9_]+
# Exists at runtime, but missing from stubs
spwd.struct_spwd.sp_nam
spwd.struct_spwd.sp_pwd
# Platform differences that cannot be captured by the type system
(posix.O_[A-Z_]+)?
(posix.ST_[A-Z]+)?
(termios.[A-Z0-9_]+)?
_ctypes.dlclose
_ctypes.dlopen
_ctypes.dlsym
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Modules that do not exist on Linux systems
_msi
_winapi
asyncio.windows_events
asyncio.windows_utils
msilib(.[a-z]+)?
msvcrt
nt
winreg
winsound
# multiprocessing.popen_spawn_win32 exists on Linux but fail to import
multiprocessing.popen_spawn_win32
# Platform differences that cannot be captured by the type system
fcntl.I_[A-Z0-9_]+
os.SCHED_[A-Z_]+
posix.SCHED_[A-Z_]+
# Some of these exist on non-windows, but they are useless and this is not intended
stat.FILE_ATTRIBUTE_[A-Z_]+
# Methods that come from __getattr__() at runtime
tkinter.Tk.createfilehandler
tkinter.Tk.deletefilehandler
_?curses.ACS_.* # ACS codes are initialized only after initscr call
curses.COLORS # Initialized after start_color
curses.COLOR_PAIRS # Initialized after start_color
curses.COLS # Initialized only after initscr call
curses.LINES # Initialized only after initscr call

View File

@@ -0,0 +1,197 @@
_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also.
_weakref.ProxyType.__reversed__ # Doesn't really exist
asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them
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
collections\.UserList\.index # ignoring pos-or-keyword parameter
configparser.ParsingError.filename
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
email.contentmanager.typ
enum.Enum._generate_next_value_
functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically
gettext.install
gettext.translation
importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
importlib.abc.Finder.find_module
# 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
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
builtins.ellipsis # type is not exposed anywhere
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
# Runtime definition of protocol is incorrect
importlib.metadata._meta.SimplePath.__truediv__
importlib.metadata._meta.SimplePath.joinpath
# Modules that exist at runtime, but shouldn't be added to typeshed
ctypes.test
ctypes\.test\..+
lib2to3.tests
lib2to3\.tests\..+
sqlite3.test
sqlite3\.test\..+
tkinter.test
tkinter\.test\..+
unittest.test
unittest\.test\..+
# Exist at runtime for internal reasons, no need to put them in the stub
typing_extensions\.TypeAliasType\.__call__
typing_extensions\.TypeAliasType\.__init_subclass__
# We call them read-only properties, runtime implementation is slightly different
typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__
# Runtime has *args, **kwargs, but will error if any are supplied
unittest.TestCase.__init_subclass__
unittest.case.TestCase.__init_subclass__
# SpooledTemporaryFile implements IO except these methods before Python 3.11
# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918
tempfile.SpooledTemporaryFile.__next__
tempfile.SpooledTemporaryFile.readable
tempfile.SpooledTemporaryFile.seekable
tempfile.SpooledTemporaryFile.writable
# The "loop" argument exists at runtime,
# but raises TypeError if you try to provide any value for it
asyncio.BoundedSemaphore.__init__
asyncio.Condition.__init__
asyncio.Event.__init__
asyncio.Lock.__init__
asyncio.Queue.__init__
asyncio.Semaphore.__init__
asyncio.locks.BoundedSemaphore.__init__
asyncio.locks.Semaphore.__init__
asyncio.locks.Condition.__init__
asyncio.locks.Event.__init__
asyncio.locks.Lock.__init__
asyncio.locks.Semaphore.__init__
asyncio.queues.Queue.__init__
# Exists at runtime, but missing from stubs
_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__
_csv.Reader
_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
# ==========
# Related to positional-only arguments
# ==========
# These are not positional-only at runtime, but we treat them
# as positional-only to match dict.
_collections_abc.MutableMapping.pop
_collections_abc.MutableMapping.setdefault
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
# to mark these as positional-only for compatibility with existing sub-classes.
typing(_extensions)?\.BinaryIO\.write
typing(_extensions)?\.IO\.read
typing(_extensions)?\.IO\.readline
typing(_extensions)?\.IO\.readlines
typing(_extensions)?\.IO\.seek
typing(_extensions)?\.IO\.truncate
typing(_extensions)?\.IO\.write
typing(_extensions)?\.IO\.writelines
# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib
_collections_abc.Coroutine.send
_collections_abc.Coroutine.throw
_collections_abc.Generator.send
_collections_abc.Generator.throw
# typing.SupportsRound.__round__ # pos-or-kw at runtime, but we pretend it's pos-only in the stub so that e.g. float.__round__ satisfies the interface
types.DynamicClassAttribute..* # In the stub we pretend it's an alias for property, but it has positional-only differences
# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
posixpath.join
ntpath.join
os.path.join
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Runtime AST node runtime constructor behaviour is too loose.
# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378).
# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858)
_?ast.pattern.__init__
# Side effects from module initialization
_compat_pickle.excname
email.contentmanager.maintype
email.contentmanager.subtype
inspect.k
inspect.mod_dict
inspect.v
json.encoder.i
lib2to3.pgen2.grammar.line
lib2to3.pgen2.grammar.name
lib2to3.pgen2.grammar.op
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
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.ExtSlice.__new__
ast.Index.__new__
os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem
_ast.ImportFrom.level # None on the class, but never None on instances
ast.ImportFrom.level # None on the class, but never None on instances
# White lies around defaults
dataclasses.KW_ONLY
# We pretend it's a read-only property for forward compatibility with 3.12
typing.ParamSpec(Args|Kwargs).__origin__
# Problematic protocol signatures at runtime, see source code comments.
importlib.abc.Traversable.joinpath
importlib.abc.Traversable.open
# Deprecation wrapper classes; their methods are just pass-through, so we can ignore them.
importlib.metadata.DeprecatedList.reverse
importlib.metadata.DeprecatedList.sort
# Super-special typing primitives
typing\.NamedTuple
typing\.Annotated
# We lie about the existence of these methods
.*.__buffer__
.*.__release_buffer__
# Removed in 3.12
distutils\..*
asyncore.dispatcher.addr
asyncore.dispatcher.handle_accepted
asynchat.async_chat.encoding
asynchat.async_chat.use_encoding
asynchat.find_prefix_at_end
pkgutil.ImpImporter\..*
pkgutil.ImpLoader\..*
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
# These enums derive from (str, Enum)
pstats.SortKey.__new__
tkinter.EventType.__new__

View File

@@ -0,0 +1,157 @@
_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__
_csv.Reader
_csv.Writer
bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set
configparser.LegacyInterpolation.__init__
configparser.ParsingError.filename
collections\.UserList\.index # ignoring pos-or-keyword parameter
enum.Enum.__init__
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.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
importlib.abc.Finder.find_module
tkinter._VersionInfoType.__doc__
typing.NewType.__mro_entries__
builtins.ellipsis # type is not exposed anywhere
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
# Runtime definition of protocol is incorrect
importlib.metadata._meta.SimplePath.__truediv__
importlib.metadata._meta.SimplePath.joinpath
# Modules that exist at runtime, but shouldn't be added to typeshed
ctypes.test
ctypes\.test\..+
lib2to3.tests
lib2to3\.tests\..+
tkinter.test
tkinter\.test\..+
unittest.test
unittest\.test\..+
# ==========
# Related to positional-only arguments
# ==========
# These are not positional-only at runtime, but we treat them
# as positional-only to match dict.
_collections_abc.MutableMapping.pop
_collections_abc.MutableMapping.setdefault
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
# to mark these as positional-only for compatibility with existing sub-classes.
typing(_extensions)?\.BinaryIO\.write
typing(_extensions)?\.IO\.read
typing(_extensions)?\.IO\.readline
typing(_extensions)?\.IO\.readlines
typing(_extensions)?\.IO\.seek
typing(_extensions)?\.IO\.truncate
typing(_extensions)?\.IO\.write
typing(_extensions)?\.IO\.writelines
# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib
_collections_abc.Coroutine.send
_collections_abc.Coroutine.throw
_collections_abc.Generator.send
_collections_abc.Generator.throw
# typing.SupportsRound.__round__ # pos-or-kw at runtime, but we pretend it's pos-only in the stub so that e.g. float.__round__ satisfies the interface
types.DynamicClassAttribute..* # In the stub we pretend it's an alias for property, but it has positional-only differences
# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
posixpath.join
ntpath.join
os.path.join
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Runtime AST node runtime constructor behaviour is too loose.
# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378).
# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858)
_?ast.pattern.__init__
_ast.ImportFrom.level # None on the class, but never None on instances
_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also.
_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
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
functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically
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
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
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.ExtSlice.__new__
ast.Index.__new__
contextvars.Context.__init__
# Treated an alias of a typing class in the stubs,
# they are generic to type checkers anyway.
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
# 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
# Runtime has *args, **kwargs, but will error if any are supplied
unittest.TestCase.__init_subclass__
unittest.case.TestCase.__init_subclass__
# Problematic protocol signature at runtime, see source code comments.
importlib.abc.Traversable.open
importlib.resources.abc.Traversable.open
# Deprecation wrapper classes; their methods are just pass-through, so we can ignore them.
importlib.metadata.DeprecatedList.reverse
importlib.metadata.DeprecatedList.sort
# Super-special typing primitives
typing\._SpecialForm.*
typing\.NamedTuple
typing\.LiteralString
typing\.Annotated
# We pretend it's a read-only property for forward compatibility with 3.12
typing.ParamSpec(Args|Kwargs).__origin__
typing\.TypeVar\.__.*__
typing\.ParamSpec\.__.*__
# Exist at runtime for internal reasons, no need to put them in the stub
typing_extensions\.TypeAliasType\.__call__
typing_extensions\.TypeAliasType\.__init_subclass__
# We call them read-only properties, runtime implementation is slightly different
typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__
# We lie about the existence of these methods
.*.__buffer__
.*.__release_buffer__
# Removed in 3.12
distutils\..*
asyncore.dispatcher.addr
asyncore.dispatcher.handle_accepted
asynchat.async_chat.encoding
asynchat.async_chat.use_encoding
asynchat.find_prefix_at_end
pkgutil.ImpImporter\..*
pkgutil.ImpLoader\..*

View File

@@ -0,0 +1,134 @@
# Modules that exist at runtime, but are missing from typeshed
zipfile._path.glob
# Errors that also existed on Python 3.11
_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__
_csv.Reader
_csv.Writer
configparser.LegacyInterpolation.__init__
enum.Enum.__init__
importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
tkinter._VersionInfoType.__doc__
typing.NewType.__mro_entries__
builtins.ellipsis # type is not exposed anywhere
# ==========
# Related to positional-only arguments
# ==========
# These are not positional-only at runtime, but we treat them
# as positional-only to match dict.
_collections_abc.MutableMapping.pop
_collections_abc.MutableMapping.setdefault
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
# to mark these as positional-only for compatibility with existing sub-classes.
typing(_extensions)?\.BinaryIO\.write
typing(_extensions)?\.IO\.read
typing(_extensions)?\.IO\.readline
typing(_extensions)?\.IO\.readlines
typing(_extensions)?\.IO\.seek
typing(_extensions)?\.IO\.truncate
typing(_extensions)?\.IO\.write
typing(_extensions)?\.IO\.writelines
# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib
_collections_abc.Coroutine.send
_collections_abc.Coroutine.throw
_collections_abc.Generator.send
_collections_abc.Generator.throw
# typing.SupportsRound.__round__ # pos-or-kw at runtime, but we pretend it's pos-only in the stub so that e.g. float.__round__ satisfies the interface
types.DynamicClassAttribute..* # In the stub we pretend it's an alias for property, but it has positional-only differences
# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
posixpath.join
ntpath.join
os.path.join
# Pos-only parameters had different "names" in different Python versions:
zoneinfo.ZoneInfo.from_file
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Runtime AST node runtime constructor behaviour is too loose.
# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378).
# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858)
_?ast.pattern.__init__
_?ast.type_param.__init__
_ast.ImportFrom.level # None on the class, but never None on instances
_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also.
_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
builtins.property.__set_name__ # Doesn't actually exist
collections\.UserList\.index # ignoring pos-or-keyword parameter
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
functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically
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
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
types.GenericAlias.__getattr__
types.GenericAlias.__mro_entries__
sys._monitoring # Doesn't really exist. See comments in the stub.
weakref.ProxyType.__reversed__ # Doesn't really exist
importlib.metadata._meta.SimplePath.joinpath # Incorrect runtime definition
# sys attributes that are not always defined
sys.last_exc
# C signature is broader than what is actually accepted
ast.ExtSlice.__new__
ast.Index.__new__
contextvars.Context.__init__
# Treated an alias of a typing class in the stubs,
# they are generic to type checkers anyway.
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
# 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
# Runtime has *args, **kwargs, but will error if any are supplied
unittest.TestCase.__init_subclass__
unittest.case.TestCase.__init_subclass__
# Problematic protocol signature at runtime, see source code comments.
importlib.abc.Traversable.open
importlib.resources.abc.Traversable.open
# Deprecation wrapper classes; their methods are just pass-through, so we can ignore them.
importlib.metadata.DeprecatedNonAbstract.__new__
# Super-special typing primitives
typing\._SpecialForm.*
typing\.NamedTuple
typing\.LiteralString
typing\.Annotated
# These only exist to give a better error message if you try to subclass an instance
typing.ParamSpec.__mro_entries__
typing.ParamSpecArgs.__mro_entries__
typing.ParamSpecKwargs.__mro_entries__
typing.TypeVar.__mro_entries__
typing.TypeVarTuple.__mro_entries__
# TODO: mypy should infer that this attribute is inherited from builtins.type;
# why doesn't it infer this?
typing.SupportsAbs.__type_params__
typing.SupportsRound.__type_params__
typing_extensions.SupportsAbs.__type_params__
typing_extensions.SupportsRound.__type_params__

View File

@@ -0,0 +1,190 @@
_dummy_threading.Condition.acquire
_dummy_threading.Condition.release
_dummy_threading.Event.isSet
_dummy_threading.ExceptHookArgs
_dummy_threading.Lock
_dummy_threading.RLock
_dummy_threading.Thread.native_id
_dummy_threading._DummyThread.__init__
_dummy_threading._RLock.__enter__
_dummy_threading.local.__new__
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
asyncio.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself
builtins.float.__set_format__ # 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
collections.AsyncGenerator.asend # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also.
collections.AsyncGenerator.__anext__ # async at runtime, deliberately not in the stub, see #7491
collections.AsyncGenerator.aclose # async at runtime, deliberately not in the stub, see #7491
collections.AsyncIterator.__anext__ # async at runtime, deliberately not in the stub, see #7491
collections.AsyncGenerator.ag_await
collections.AsyncGenerator.ag_code
collections.AsyncGenerator.ag_frame
collections.AsyncGenerator.ag_running
collections.ByteString # see comments in py3_common.txt
collections.Callable
collections.ItemsView.__reversed__
collections.KeysView.__reversed__
collections.ValuesView.__reversed__
collections.Mapping.__reversed__ # Set to None at runtime for a better error message
configparser.ParsingError.filename
dummy_threading.Condition.acquire
dummy_threading.Condition.release
dummy_threading.Event.isSet
dummy_threading.Thread.native_id
dummy_threading.local.__new__
email.contentmanager.typ
enum.Enum._generate_next_value_
gettext.install # codeset default value is ['unspecified'] so can't be specified
gettext.translation # codeset default value is ['unspecified'] so can't be specified
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
sched.Event.__doc__ # __slots__ is overridden
typing.NamedTuple.__new__
typing.NamedTuple._asdict
typing.NamedTuple._make
typing.NamedTuple._replace
typing._SpecialForm.__new__
xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495
xml.etree.cElementTree.TreeBuilder.start # bpo-39495
xxsubtype # module missing from the stubs
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
# Exist at runtime for internal reasons, no need to put them in the stub
typing_extensions\.TypeAliasType\.__call__
typing_extensions\.TypeAliasType\.__init_subclass__
# We call them read-only properties, runtime implementation is slightly different
typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__
collections.Coroutine.cr_await
collections.Coroutine.cr_code
collections.Coroutine.cr_frame
collections.Coroutine.cr_running
collections.Generator.gi_code
collections.Generator.gi_frame
collections.Generator.gi_running
collections.Generator.gi_yieldfrom
collections.Mapping.get # Adding None to the Union messed up mypy
collections.Sequence.index # Supporting None in end is not mandatory
# SpooledTemporaryFile implements IO except these methods before Python 3.11
# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918
tempfile.SpooledTemporaryFile.__next__
tempfile.SpooledTemporaryFile.readable
tempfile.SpooledTemporaryFile.seekable
tempfile.SpooledTemporaryFile.writable
# Default values given in the stub are a white lie, see #9637
tkinter.Tcl
tkinter.Tk.__init__
# Exists at runtime, but missing from stubs
contextvars.ContextVar.__class_getitem__
datetime.datetime_CAPI
dummy_threading.ExceptHookArgs
dummy_threading.Lock
dummy_threading.RLock
html.parser.HTMLParser.unescape
plistlib.Data.asBase64
plistlib.Data.fromBase64
tempfile.SpooledTemporaryFile.softspace
tkinter.Tk.split
tkinter.commondialog.[A-Z_]+
tkinter.commondialog.TclVersion
tkinter.commondialog.TkVersion
tkinter.commondialog.wantobjects
tkinter.dialog.[A-Z_]+
tkinter.dialog.TclVersion
tkinter.dialog.TkVersion
tkinter.dialog.wantobjects
tkinter.dnd.Icon
tkinter.dnd.Tester
tkinter.dnd.test
tkinter.filedialog.[A-Z_]+
tkinter.filedialog.TclVersion
tkinter.filedialog.TkVersion
tkinter.filedialog.wantobjects
tkinter.simpledialog.wantobjects
tkinter.tix.wantobjects
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Side effects from module initialization
_compat_pickle.excname
email.contentmanager.maintype
email.contentmanager.subtype
inspect.k
inspect.mod_dict
inspect.v
json.encoder.i
lib2to3.pgen2.grammar.line
lib2to3.pgen2.grammar.name
lib2to3.pgen2.grammar.op
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
# Adding these reflected dunders to `typing.AbstractSet` causes a large number of false-positives. See #7414.
collections.Set.__rand__
collections.Set.__ror__
collections.Set.__rsub__
collections.Set.__rxor__
builtins.memoryview.__iter__ # C type that implements __getitem__
builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only
# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
builtins.classmethod.__get__
builtins.property.__get__
builtins.staticmethod.__get__
types.FunctionType.__get__
types.LambdaType.__get__
types.ClassMethodDescriptorType.__get__
types.GetSetDescriptorType.__get__
types.MemberDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
# We lie about the existence of these methods
.*.__buffer__
.*.__release_buffer__
# A property at runtime that works like a method.
zipfile.Path.open
# Removed in 3.12
distutils\..*
asyncore.dispatcher.addr
asyncore.dispatcher.handle_accepted
asynchat.async_chat.encoding
asynchat.async_chat.use_encoding
asynchat.find_prefix_at_end
pkgutil.ImpImporter\..*
pkgutil.ImpLoader\..*
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
# Modules that exist at runtime, but shouldn't be added to typeshed
ctypes.test
ctypes\.test\..+
lib2to3.tests
lib2to3\.tests\..+
sqlite3.test
sqlite3\.test\..+
test
tkinter.test
tkinter\.test\..+
unittest.test
unittest\.test\..+
# These enums derive from (str, Enum)
pstats.SortKey.__new__
tkinter.EventType.__new__

View File

@@ -0,0 +1,173 @@
_weakref.ProxyType.__reversed__ # Doesn't really exist
ast.ExtSlice.__new__
ast.Index.__new__
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
collections.AsyncGenerator.asend # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also.
collections.AsyncGenerator.__anext__ # async at runtime, deliberately not in the stub, see #7491
collections.AsyncGenerator.aclose # async at runtime, deliberately not in the stub, see #7491
collections.AsyncIterator.__anext__ # async at runtime, deliberately not in the stub, see #7491
collections.AsyncGenerator.ag_await
collections.AsyncGenerator.ag_code
collections.AsyncGenerator.ag_frame
collections.AsyncGenerator.ag_running
collections.ByteString # see comments in py3_common.txt
collections.Callable
collections.Mapping.__reversed__ # Set to None at runtime for a better error message
collections.ItemsView.__reversed__
collections.KeysView.__reversed__
collections.ValuesView.__reversed__
configparser.ParsingError.filename
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
email.contentmanager.typ
enum.Enum._generate_next_value_
functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically
gettext.install
gettext.translation
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
# 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
tkinter.Tk.split
types.GenericAlias.__getattr__
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
weakref.ProxyType.__reversed__ # Doesn't really exist
xxsubtype # module missing from the stubs
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
# Exist at runtime for internal reasons, no need to put them in the stub
typing_extensions\.TypeAliasType\.__call__
typing_extensions\.TypeAliasType\.__init_subclass__
# We call them read-only properties, runtime implementation is slightly different
typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__
collections.Coroutine.cr_await
collections.Coroutine.cr_code
collections.Coroutine.cr_frame
collections.Coroutine.cr_running
collections.Generator.gi_code
collections.Generator.gi_frame
collections.Generator.gi_running
collections.Generator.gi_yieldfrom
collections.Mapping.get # Adding None to the Union messed up mypy
collections.Sequence.index # Supporting None in end is not mandatory
# Modules that exist at runtime, but shouldn't be added to typeshed
ctypes.test
ctypes\.test\..+
lib2to3.tests
lib2to3\.tests\..+
sqlite3.test
sqlite3\.test\..+
test
tkinter.test
tkinter\.test\..+
unittest.test
unittest\.test\..+
# Exists at runtime, but missing from stubs
_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__
collections.AsyncIterable.__class_getitem__
collections.Awaitable.__class_getitem__
collections.Container.__class_getitem__
collections.Iterable.__class_getitem__
collections.MappingView.__class_getitem__
hmac.HMAC.digest_cons
hmac.HMAC.inner
hmac.HMAC.outer
types.GenericAlias.__mro_entries__
typing._SpecialForm.__mro_entries__
# SpooledTemporaryFile implements IO except these methods before Python 3.11
# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918
tempfile.SpooledTemporaryFile.__next__
tempfile.SpooledTemporaryFile.readable
tempfile.SpooledTemporaryFile.seekable
tempfile.SpooledTemporaryFile.writable
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Side effects from module initialization
_compat_pickle.excname
email.contentmanager.maintype
email.contentmanager.subtype
inspect.k
inspect.mod_dict
inspect.v
json.encoder.i
lib2to3.pgen2.grammar.line
lib2to3.pgen2.grammar.name
lib2to3.pgen2.grammar.op
poplib.POP3_SSL.stls # bad declaration of inherited function. See poplib.pyi
pydoc.Helper.symbol # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.symbols_ # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
pydoc.Helper.topic # Loop variable in class https://github.com/python/typeshed/issues/6401#issuecomment-981178522
# Adding these reflected dunders to `typing.AbstractSet` causes a large number of false-positives. See #7414.
collections.Set.__rand__
collections.Set.__ror__
collections.Set.__rsub__
collections.Set.__rxor__
builtins.memoryview.__iter__ # C type that implements __getitem__
builtins.memoryview.cast # inspect.signature is incorrect about shape being kw-only
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
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)
builtins.classmethod.__get__
builtins.property.__get__
builtins.staticmethod.__get__
types.FunctionType.__get__
types.LambdaType.__get__
types.ClassMethodDescriptorType.__get__
types.GetSetDescriptorType.__get__
types.MemberDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
# Problematic protocol signature at runtime, see source code comments.
importlib.abc.Traversable.open
# Super-special typing primitives
typing\.NamedTuple
typing\.Annotated
# We lie about the existence of these methods
.*.__buffer__
.*.__release_buffer__
# Removed in 3.12
distutils\..*
asyncore.dispatcher.addr
asyncore.dispatcher.handle_accepted
asynchat.async_chat.encoding
asynchat.async_chat.use_encoding
asynchat.find_prefix_at_end
pkgutil.ImpImporter\..*
pkgutil.ImpLoader\..*
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
# These enums derive from (str, Enum)
pstats.SortKey.__new__
tkinter.EventType.__new__

View File

@@ -0,0 +1,6 @@
tarfile.TarInfo.replace
# pathlib methods that exist on Windows, but always raise NotImplementedError,
# so are omitted from the stub
pathlib.Path.is_mount
pathlib.WindowsPath.is_mount

View File

@@ -0,0 +1,4 @@
# pathlib methods that exist on Windows, but always raise NotImplementedError,
# so are omitted from the stub
pathlib.Path.is_mount
pathlib.WindowsPath.is_mount

View File

@@ -0,0 +1,4 @@
# Undocumented internal method, not really for public consumption.
# (Hard to add types for unless we add stubs for the undocumented _overlapped module...)
asyncio.IocpProactor.finish_socket_func
asyncio.windows_events.IocpProactor.finish_socket_func

View File

@@ -0,0 +1,12 @@
tarfile.TarInfo.replace
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# pathlib methods that exist on Windows, but always raise NotImplementedError,
# so are omitted from the stub
pathlib.Path.is_mount
pathlib.WindowsPath.group
pathlib.WindowsPath.owner
pathlib.WindowsPath.is_mount

View File

@@ -0,0 +1,6 @@
tarfile.TarInfo.replace
# pathlib methods that exist on Windows, but always raise NotImplementedError,
# so are omitted from the stub
pathlib.Path.is_mount
pathlib.WindowsPath.is_mount

View File

@@ -0,0 +1,62 @@
ctypes.GetLastError # Is actually a pointer
# alias for a class defined elsewhere,
# mypy infers the variable has type `(*args) -> DupHandle` but stubtest infers the runtime type as <class DupHandle>
multiprocessing.reduction.AbstractReducer.DupHandle
# Exists at runtime, but missing from stubs
encodings.mbcs
encodings.oem
_winapi.CreateFileMapping
_winapi.MapViewOfFile
_winapi.OpenFileMapping
_winapi.VirtualQuerySize
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========
# Modules that do not exist on Windows systems
_curses
_posixsubprocess
asyncio.unix_events
crypt
dbm.gnu
dbm.ndbm
fcntl
grp
nis
ossaudiodev
posix
pwd
readline
resource
spwd
syslog
termios
xxlimited
# multiprocessing.popen_fork, popen_forkserver, and popen_spawn_posix exist on Windows but fail to import
multiprocessing.popen_fork
multiprocessing.popen_forkserver
multiprocessing.popen_spawn_posix
# Modules that rely on _curses
curses
curses.ascii
curses.has_key
curses.panel
curses.textpad
# Modules that rely on termios
pty
tty
# pathlib functions that rely on modules that don't exist on Windows
pathlib.Path.owner
pathlib.Path.group
# Added in a patch release, backported to all security branches,
# but have yet to find their way to all GitHub Actions images
(sys.get_int_max_str_digits)?
(sys.set_int_max_str_digits)?