Skip to content

Commit 1b9a9d7

Browse files
authored
Remove Python 3.9 stubtest allowlists (#15403)
Move now common items to common.txt
1 parent 34646ba commit 1b9a9d7

File tree

10 files changed

+40
-720
lines changed

10 files changed

+40
-720
lines changed

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ _frozen_importlib_external.WindowsRegistryFinder.REGISTRY_KEY
5959
_frozen_importlib_external.WindowsRegistryFinder.REGISTRY_KEY_DEBUG
6060

6161
builtins.OSError.characters_written # GetSetDescriptor that always raises AttributeError
62+
builtins.ellipsis # does not exist at runtime, see https://github.com/python/typeshed/issues/7580
6263
builtins.float.__getformat__ # Internal method for CPython test suite
6364

6465
# These super() dunders don't seem to be particularly useful,
@@ -180,11 +181,22 @@ 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
@@ -217,6 +229,7 @@ argparse.Namespace.__getattr__ # The whole point of this class is its attribute
217229
_?ast.AST.__init__
218230
_?ast.excepthandler.__init__
219231
_?ast.expr.__init__
232+
_?ast.pattern.__init__
220233
_?ast.stmt.__init__
221234

222235
_ast.ImportFrom.level # None on the class, but never None on instances
@@ -235,6 +248,7 @@ asyncio.locks.Condition.locked
235248
asyncio.locks.Condition.release
236249

237250
builtins.memoryview.__contains__ # C type that implements __getitem__
251+
builtins.property.__set_name__ # Doesn't actually exist
238252
builtins.reveal_locals # Builtins that type checkers pretends exist
239253
builtins.reveal_type # Builtins that type checkers pretends exist
240254

@@ -251,6 +265,7 @@ codecs.CodecInfo.streamwriter
251265
codecs.StreamReaderWriter.\w+
252266
codecs.StreamRecoder.\w+
253267

268+
collections.UserList.index # ignoring pos-or-keyword parameter
254269
collections.UserList.sort # Runtime has *args but will error if any are supplied
255270
collections.abc.* # Types are re-exported from _collections_abc, so errors should be fixed there
256271
configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used
@@ -287,6 +302,8 @@ _?ctypes.Union.__setattr__ # doesn't exist, but makes things easy if we pretend
287302
# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
288303
_?ctypes.Array.__iter__
289304

305+
dataclasses.KW_ONLY # white lies around defaults
306+
290307
# __all__-related weirdness (see #6523)
291308
email.__all__
292309
email.base64mime
@@ -317,6 +334,8 @@ http.HTTPStatus.description # set in __new__; work-around for enum wierdness
317334
http.HTTPStatus.phrase # set in __new__; work-around for enum wierdness
318335
imaplib.IMAP4_SSL.ssl # Depends on the existence and flags of SSL
319336

337+
importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
338+
320339
# runtime is *args, **kwargs due to a wrapper; we have more accurate signatures in the stubs
321340
importlib._bootstrap_external.ExtensionFileLoader.get_filename
322341
importlib._bootstrap_external.FileLoader.get_filename
@@ -326,6 +345,8 @@ importlib.abc.FileLoader.get_filename
326345
importlib.abc.FileLoader.load_module
327346
importlib.machinery.ExtensionFileLoader.get_filename
328347

348+
importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect
349+
329350
# We can't distinguish not having a default value from having a default value of inspect.Parameter.empty
330351
inspect.Parameter.__init__
331352
inspect.Signature.__init__
@@ -446,6 +467,8 @@ traceback.TracebackException.from_exception # explicitly expanding arguments go
446467
turtle.ScrolledCanvas.find_all # Dynamically created, has unnecessary *args
447468
turtle.ScrolledCanvas.select_clear # Dynamically created, has unnecessary *args
448469
turtle.ScrolledCanvas.select_item # Dynamically created, has unnecessary *args
470+
# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that)
471+
tkinter.ttk.Style.element_create
449472

450473
types.GenericAlias.__call__ # Would be complicated to fix properly, Any could silence problems. #6392
451474
types.GenericAlias.__getattr__
@@ -516,6 +539,17 @@ typing(_extensions)?\.(Async)?ContextManager
516539
typing(_extensions)?\.IO\.__iter__
517540
typing(_extensions)?\.IO\.__next__
518541

542+
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
543+
# to mark these as positional-only for compatibility with existing sub-classes.
544+
typing(_extensions)?\.BinaryIO\.write
545+
typing(_extensions)?\.IO\.read
546+
typing(_extensions)?\.IO\.readline
547+
typing(_extensions)?\.IO\.readlines
548+
typing(_extensions)?\.IO\.seek
549+
typing(_extensions)?\.IO\.truncate
550+
typing(_extensions)?\.IO\.write
551+
typing(_extensions)?\.IO\.writelines
552+
519553
types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
520554
types.MethodType.__code__ # read-only but not actually a property; stubtest thinks it doesn't exist.
521555
types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.
@@ -550,3 +584,8 @@ xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signatu
550584
# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
551585
xml.etree.ElementTree.Element.__iter__
552586
xml.etree.cElementTree.Element.__iter__
587+
588+
# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
589+
posixpath.join
590+
ntpath.join
591+
os.path.join

stdlib/@tests/stubtest_allowlists/darwin-py39.txt

Lines changed: 0 additions & 83 deletions
This file was deleted.

stdlib/@tests/stubtest_allowlists/linux-py39.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.

stdlib/@tests/stubtest_allowlists/py310.txt

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,6 @@
33
# =========================
44

55

6-
# =======
7-
# >= 3.10
8-
# =======
9-
10-
builtins.ellipsis # type is not exposed anywhere
11-
importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
12-
13-
# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib
14-
_collections_abc.Coroutine.send
15-
_collections_abc.Coroutine.throw
16-
_collections_abc.Generator.send
17-
_collections_abc.Generator.throw
18-
19-
# These are not positional-only at runtime, but we treat them as positional-only to match dict.
20-
_collections_abc.MutableMapping.pop
21-
_collections_abc.MutableMapping.setdefault
22-
23-
# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
24-
posixpath.join
25-
ntpath.join
26-
os.path.join
27-
28-
# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that)
29-
tkinter.ttk.Style.element_create
30-
31-
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
32-
# to mark these as positional-only for compatibility with existing sub-classes.
33-
typing(_extensions)?\.BinaryIO\.write
34-
typing(_extensions)?\.IO\.read
35-
typing(_extensions)?\.IO\.readline
36-
typing(_extensions)?\.IO\.readlines
37-
typing(_extensions)?\.IO\.seek
38-
typing(_extensions)?\.IO\.truncate
39-
typing(_extensions)?\.IO\.write
40-
typing(_extensions)?\.IO\.writelines
41-
42-
436
# =========
447
# 3.10 only
458
# =========
@@ -166,22 +129,6 @@ importlib.abc.Traversable.open # Problematic protocol signature at runtime, see
166129
typing_extensions.TypeAliasType.__call__
167130

168131

169-
# =============================================================
170-
# Allowlist entries that cannot or should not be fixed; >= 3.10
171-
# =============================================================
172-
173-
# Runtime AST node runtime constructor behaviour is too loose.
174-
# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378).
175-
# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858)
176-
_?ast.pattern.__init__
177-
178-
_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also.
179-
builtins.property.__set_name__ # Doesn't actually exist
180-
collections\.UserList\.index # ignoring pos-or-keyword parameter
181-
dataclasses.KW_ONLY # white lies around defaults
182-
importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect
183-
184-
185132
# ===============================================================
186133
# Allowlist entries that cannot or should not be fixed; 3.10 only
187134
# ===============================================================

stdlib/@tests/stubtest_allowlists/py311.txt

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,6 @@ enum.StrEnum._generate_next_value_
2323
# ====================================
2424

2525

26-
# =======
27-
# >= 3.10
28-
# =======
29-
30-
builtins.ellipsis # type is not exposed anywhere
31-
importlib._abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
32-
33-
# positional-only complaints caused by differences between typing aliases and the "real" classes in the stdlib
34-
_collections_abc.Coroutine.send
35-
_collections_abc.Coroutine.throw
36-
_collections_abc.Generator.send
37-
_collections_abc.Generator.throw
38-
39-
# These are not positional-only at runtime, but we treat them as positional-only to match dict.
40-
_collections_abc.MutableMapping.pop
41-
_collections_abc.MutableMapping.setdefault
42-
43-
# These three have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
44-
posixpath.join
45-
ntpath.join
46-
os.path.join
47-
48-
# this is implemented with *args having a minimum size so arguments before it must be positional (but stubtest doesn't see that)
49-
tkinter.ttk.Style.element_create
50-
51-
# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
52-
# to mark these as positional-only for compatibility with existing sub-classes.
53-
typing(_extensions)?\.BinaryIO\.write
54-
typing(_extensions)?\.IO\.read
55-
typing(_extensions)?\.IO\.readline
56-
typing(_extensions)?\.IO\.readlines
57-
typing(_extensions)?\.IO\.seek
58-
typing(_extensions)?\.IO\.truncate
59-
typing(_extensions)?\.IO\.write
60-
typing(_extensions)?\.IO\.writelines
61-
62-
6326
# ============
6427
# 3.10 to 3.11
6528
# ============
@@ -152,22 +115,6 @@ typing\._SpecialForm.* # Super-special typing primitive
152115
typing\.LiteralString # Super-special typing primitive
153116

154117

155-
# =============================================================
156-
# Allowlist entries that cannot or should not be fixed; >= 3.10
157-
# =============================================================
158-
159-
# Runtime AST node runtime constructor behaviour is too loose.
160-
# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378).
161-
# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858)
162-
_?ast.pattern.__init__
163-
164-
_collections_abc.AsyncGenerator.athrow # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also.
165-
builtins.property.__set_name__ # Doesn't actually exist
166-
collections\.UserList\.index # ignoring pos-or-keyword parameter
167-
dataclasses.KW_ONLY # white lies around defaults
168-
importlib.metadata._meta.SimplePath.joinpath # Runtime definition of protocol is incorrect
169-
170-
171118
# ===============================================================
172119
# Allowlist entries that cannot or should not be fixed; 3.11 only
173120
# ===============================================================

0 commit comments

Comments
 (0)