Skip to content

Commit 753cb3d

Browse files
committed
Move unused allowlist entries
1 parent ebd3f94 commit 753cb3d

6 files changed

Lines changed: 130 additions & 17 deletions

File tree

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,6 @@ _collections_abc.AsyncGenerator.__anext__
183183
_collections_abc.AsyncGenerator.aclose
184184
_collections_abc.AsyncIterator.__anext__
185185

186-
# Pretend typing.ByteString is a Union, to better match its documented semantics.
187-
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
188-
# because it's not an ABC that makes any sense and was deprecated in 3.12
189-
_collections_abc.ByteString
190-
191186
_collections_abc.Callable # Typing-related weirdness
192187
_collections_abc.Mapping.get # Adding None to the Union messed up mypy
193188
_collections_abc.Sequence.index # Supporting None in end is not mandatory
@@ -215,12 +210,7 @@ _?ast.stmt.__init__
215210

216211
_ast.ImportFrom.level # None on the class, but never None on instances
217212

218-
ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
219-
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
220213
ast.ImportFrom.level # None on the class, but never None on instances
221-
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
222-
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
223-
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
224214
ast.NodeVisitor.visit_\w+ # Methods are discovered dynamically, see #3796
225215
_?asyncio.Future.__init__ # Usually initialized from c object
226216
asyncio.futures.Future.__init__ # Usually initialized from c object
@@ -312,7 +302,6 @@ enum.auto.__xor__ # enum.auto is magic, see comments
312302
functools._lru_cache_wrapper.cache_parameters # Cannot be detected statically
313303
functools.cached_property.__set__ # doesn't exist, but cached_property is settable by another mechanism
314304

315-
_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
316305
hmac.new # Raises TypeError if optional argument digestmod is not provided
317306
http.HTTPStatus.description # set in __new__; work-around for enum wierdness
318307
http.HTTPStatus.phrase # set in __new__; work-around for enum wierdness
@@ -325,7 +314,6 @@ importlib._bootstrap_external.FileLoader.get_resource_reader
325314
importlib._bootstrap_external.FileLoader.load_module
326315
importlib.abc.FileLoader.get_filename
327316
importlib.abc.FileLoader.load_module
328-
importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.
329317
importlib.machinery.ExtensionFileLoader.get_filename
330318

331319
# We can't distinguish not having a default value from having a default value of inspect.Parameter.empty
@@ -472,7 +460,6 @@ typing_extensions\.TypeVar.*
472460
typing_extensions\._SpecialForm.*
473461

474462
# Special primitives
475-
typing\.ByteString
476463
typing(_extensions)?\.AbstractSet
477464
typing(_extensions)?\.AsyncGenerator
478465
typing(_extensions)?\.AsyncIterable
@@ -527,10 +514,6 @@ typing(_extensions)?\.(Async)?ContextManager
527514
typing(_extensions)?\.IO\.__iter__
528515
typing(_extensions)?\.IO\.__next__
529516

530-
# Will always raise. Not included to avoid type checkers inferring that
531-
# TypeAliasType instances are callable.
532-
typing_extensions.TypeAliasType.__call__
533-
534517
types.MethodType.__closure__ # read-only but not actually a property; stubtest thinks it doesn't exist.
535518
types.MethodType.__code__ # read-only but not actually a property; stubtest thinks it doesn't exist.
536519
types.MethodType.__defaults__ # read-only but not actually a property; stubtest thinks it doesn't exist.

stdlib/@tests/stubtest_allowlists/py310.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,32 @@ tkinter.tix.TclVersion
150150
tkinter.tix.TkVersion
151151

152152

153+
# =======
154+
# <= 3.13
155+
# =======
156+
157+
# Pretend typing.ByteString is a Union, to better match its documented semantics.
158+
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
159+
# because it's not an ABC that makes any sense and was deprecated in 3.12
160+
_collections_abc.ByteString
161+
162+
ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
163+
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
164+
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
165+
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
166+
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
167+
168+
_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
169+
170+
importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.
171+
172+
typing\.ByteString
173+
174+
# Will always raise. Not included to avoid type checkers inferring that
175+
# TypeAliasType instances are callable.
176+
typing_extensions.TypeAliasType.__call__
177+
178+
153179
# =============================================================
154180
# Allowlist entries that cannot or should not be fixed; >= 3.10
155181
# =============================================================

stdlib/@tests/stubtest_allowlists/py311.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,32 @@ tkinter.tix.TclVersion
117117
tkinter.tix.TkVersion
118118

119119

120+
# =======
121+
# <= 3.13
122+
# =======
123+
124+
# Pretend typing.ByteString is a Union, to better match its documented semantics.
125+
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
126+
# because it's not an ABC that makes any sense and was deprecated in 3.12
127+
_collections_abc.ByteString
128+
129+
ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
130+
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
131+
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
132+
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
133+
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
134+
135+
_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
136+
137+
importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.
138+
139+
typing\.ByteString
140+
141+
# Will always raise. Not included to avoid type checkers inferring that
142+
# TypeAliasType instances are callable.
143+
typing_extensions.TypeAliasType.__call__
144+
145+
120146
# =============================================================
121147
# Allowlist entries that cannot or should not be fixed; >= 3.11
122148
# =============================================================

stdlib/@tests/stubtest_allowlists/py312.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,32 @@ tkinter.tix.TclVersion
100100
tkinter.tix.TkVersion
101101

102102

103+
# =======
104+
# <= 3.13
105+
# =======
106+
107+
# Pretend typing.ByteString is a Union, to better match its documented semantics.
108+
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
109+
# because it's not an ABC that makes any sense and was deprecated in 3.12
110+
_collections_abc.ByteString
111+
112+
ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
113+
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
114+
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
115+
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
116+
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
117+
118+
_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
119+
120+
importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.
121+
122+
typing\.ByteString
123+
124+
# Will always raise. Not included to avoid type checkers inferring that
125+
# TypeAliasType instances are callable.
126+
typing_extensions.TypeAliasType.__call__
127+
128+
103129
# =============================================================
104130
# Allowlist entries that cannot or should not be fixed; >= 3.12
105131
# =============================================================

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,32 @@ typing(_extensions)?\.IO\.write
6161
typing(_extensions)?\.IO\.writelines
6262

6363

64+
# =======
65+
# <= 3.13
66+
# =======
67+
68+
# Pretend typing.ByteString is a Union, to better match its documented semantics.
69+
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
70+
# because it's not an ABC that makes any sense and was deprecated in 3.12
71+
_collections_abc.ByteString
72+
73+
ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
74+
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
75+
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
76+
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
77+
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
78+
79+
_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
80+
81+
importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.
82+
83+
typing\.ByteString
84+
85+
# Will always raise. Not included to avoid type checkers inferring that
86+
# TypeAliasType instances are callable.
87+
typing_extensions.TypeAliasType.__call__
88+
89+
6490
# =============================================================
6591
# Allowlist entries that cannot or should not be fixed; >= 3.13
6692
# =============================================================

stdlib/@tests/stubtest_allowlists/py39.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,32 @@ tkinter.tix.TclVersion
9797
tkinter.tix.TkVersion
9898

9999

100+
# =======
101+
# <= 3.13
102+
# =======
103+
104+
# Pretend typing.ByteString is a Union, to better match its documented semantics.
105+
# As a side effect, this changes the definition of collections.abc.ByteString, which is okay,
106+
# because it's not an ABC that makes any sense and was deprecated in 3.12
107+
_collections_abc.ByteString
108+
109+
ast.Bytes.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
110+
ast.Ellipsis.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
111+
ast.NameConstant.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
112+
ast.Num.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
113+
ast.Str.__new__ # runtime is *args, **kwargs due to a wrapper, but we have more accurate signatures in the stubs
114+
115+
_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
116+
117+
importlib.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.
118+
119+
typing\.ByteString
120+
121+
# Will always raise. Not included to avoid type checkers inferring that
122+
# TypeAliasType instances are callable.
123+
typing_extensions.TypeAliasType.__call__
124+
125+
100126
# ==============================================================
101127
# Allowlist entries that cannot or should not be fixed; 3.9 only
102128
# ==============================================================

0 commit comments

Comments
 (0)