@@ -59,6 +59,7 @@ _frozen_importlib_external.WindowsRegistryFinder.REGISTRY_KEY
5959_frozen_importlib_external.WindowsRegistryFinder.REGISTRY_KEY_DEBUG
6060
6161builtins.OSError.characters_written # GetSetDescriptor that always raises AttributeError
62+ builtins.ellipsis # does not exist at runtime, see https://github.com/python/typeshed/issues/7580
6263builtins.float.__getformat__ # Internal method for CPython test suite
6364
6465# These super() dunders don't seem to be particularly useful,
@@ -180,20 +181,49 @@ sys.tracebacklimit # Must be set first
180181# ==========================================================
181182
182183# async at runtime, deliberately not in the stub, see #7491
183- _collections_abc.AsyncGenerator.asend # pos-only differences also.
184+ _collections_abc.AsyncGenerator.asend # pos-only differences also
184185_collections_abc.AsyncGenerator.__anext__
185186_collections_abc.AsyncGenerator.aclose
187+ _collections_abc.AsyncGenerator.athrow # pos-only differences also
186188_collections_abc.AsyncIterator.__anext__
187189
190+ # positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib
191+ _collections_abc.Coroutine.send
192+ _collections_abc.Coroutine.throw
193+ _collections_abc.Generator.send
194+ _collections_abc.Generator.throw
195+
196+ # These are not positional-only at runtime, but we treat them as positional-only to match dict.
197+ _collections_abc.MutableMapping.pop
198+ _collections_abc.MutableMapping.setdefault
199+
188200# Pretend typing.ByteString is a Union, to better match its documented semantics.
189201# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
190202# because it's not an ABC that makes any sense and was deprecated in 3.12
191203_collections_abc\.ByteString
192204typing\.ByteString
193205
194206_collections_abc.Callable # Typing-related weirdness
195- _collections_abc.Mapping.get # Adding None to the Union messed up mypy
196- _collections_abc.Sequence.index # Supporting None in end is not mandatory
207+
208+ # While the implementation in _collections_abc.py uses positional-or-keyword args,
209+ # this is unsafe as canonical types list/dict/set etc. only support positional args.
210+ # See: https://github.com/python/typeshed/issues/14071
211+ # See: https://github.com/python/cpython/issues/135312
212+ _collections_abc.Mapping.get
213+ _collections_abc.MutableSequence.append
214+ _collections_abc.MutableSequence.extend
215+ _collections_abc.MutableSequence.insert
216+ _collections_abc.MutableSequence.pop
217+ _collections_abc.MutableSequence.remove
218+ _collections_abc.MutableSet.add
219+ _collections_abc.MutableSet.discard
220+ _collections_abc.MutableSet.remove
221+ _collections_abc.Sequence.count
222+ _collections_abc.Sequence.index
223+ _collections_abc.Set.isdisjoint
224+ _collections_abc.Set._from_iterable
225+ _collections_abc.ItemsView._from_iterable
226+ _collections_abc.KeysView._from_iterable
197227
198228_ctypes.CFuncPtr # stubtest erroneously thinks it can't be subclassed
199229
@@ -217,6 +247,7 @@ argparse.Namespace.__getattr__ # The whole point of this class is its attribute
217247_?ast.AST.__init__
218248_?ast.excepthandler.__init__
219249_?ast.expr.__init__
250+ _?ast.pattern.__init__
220251_?ast.stmt.__init__
221252
222253_ast.ImportFrom.level # None on the class, but never None on instances
@@ -235,6 +266,7 @@ asyncio.locks.Condition.locked
235266asyncio.locks.Condition.release
236267
237268builtins.memoryview.__contains__ # C type that implements __getitem__
269+ builtins.property.__set_name__ # Doesn't actually exist
238270builtins.reveal_locals # Builtins that type checkers pretends exist
239271builtins.reveal_type # Builtins that type checkers pretends exist
240272
@@ -251,6 +283,7 @@ codecs.CodecInfo.streamwriter
251283codecs.StreamReaderWriter.\w+
252284codecs.StreamRecoder.\w+
253285
286+ collections.UserList.index # ignoring pos-or-keyword parameter
254287collections.UserList.sort # Runtime has *args but will error if any are supplied
255288collections.abc.* # Types are re-exported from _collections_abc, so errors should be fixed there
256289configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used
@@ -287,6 +320,8 @@ _?ctypes.Union.__setattr__ # doesn't exist, but makes things easy if we pretend
287320# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
288321_?ctypes.Array.__iter__
289322
323+ dataclasses.KW_ONLY # white lies around defaults
324+
290325# __all__-related weirdness (see #6523)
291326email.__all__
292327email.base64mime
@@ -317,6 +352,8 @@ http.HTTPStatus.description # set in __new__; work-around for enum wierdness
317352http.HTTPStatus.phrase # set in __new__; work-around for enum wierdness
318353imaplib.IMAP4_SSL.ssl # Depends on the existence and flags of SSL
319354
355+ importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
356+
320357# runtime is *args, **kwargs due to a wrapper; we have more accurate signatures in the stubs
321358importlib._bootstrap_external.ExtensionFileLoader.get_filename
322359importlib._bootstrap_external.FileLoader.get_filename
@@ -326,6 +363,8 @@ importlib.abc.FileLoader.get_filename
326363importlib.abc.FileLoader.load_module
327364importlib.machinery.ExtensionFileLoader.get_filename
328365
366+ importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect
367+
329368# We can't distinguish not having a default value from having a default value of inspect.Parameter.empty
330369inspect.Parameter.__init__
331370inspect.Signature.__init__
@@ -446,6 +485,8 @@ traceback.TracebackException.from_exception # explicitly expanding arguments go
446485turtle.ScrolledCanvas.find_all # Dynamically created, has unnecessary *args
447486turtle.ScrolledCanvas.select_clear # Dynamically created, has unnecessary *args
448487turtle.ScrolledCanvas.select_item # Dynamically created, has unnecessary *args
488+ # this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that)
489+ tkinter.ttk.Style.element_create
449490
450491types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
451492types.GenericAlias.__getattr__
@@ -516,6 +557,17 @@ typing(_extensions)?\.(Async)?ContextManager
516557typing(_extensions)?\.IO\.__iter__
517558typing(_extensions)?\.IO\.__next__
518559
560+ # typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
561+ # to mark these as positional-only for compatibility with existing sub-classes.
562+ typing(_extensions)?\.BinaryIO\.write
563+ typing(_extensions)?\.IO\.read
564+ typing(_extensions)?\.IO\.readline
565+ typing(_extensions)?\.IO\.readlines
566+ typing(_extensions)?\.IO\.seek
567+ typing(_extensions)?\.IO\.truncate
568+ typing(_extensions)?\.IO\.write
569+ typing(_extensions)?\.IO\.writelines
570+
519571types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
520572types.MethodType.__code__ # read-only but not actually a property; stubtest thinks it doesn't exist.
521573types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.
@@ -550,3 +602,8 @@ xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signatu
550602# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
551603xml.etree.ElementTree.Element.__iter__
552604xml.etree.cElementTree.Element.__iter__
605+
606+ # These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
607+ posixpath.join
608+ ntpath.join
609+ os.path.join
0 commit comments