Skip to content

Commit 4076e24

Browse files
Python 3.15: sort allowlists, more small updates (#15714)
1 parent 4f63ff2 commit 4076e24

9 files changed

Lines changed: 186 additions & 137 deletions

File tree

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ unittest.runner._WritelnDecorator.write # Methods that come from __getattr__()
457457
urllib.response.addbase.write # Methods that come from __getattr__() at runtime
458458
urllib.response.addbase.writelines # Methods that come from __getattr__() at runtime
459459

460+
(hashlib.__all__)? # scrypt depends on how OpenSSL was built.
461+
(pydoc.Doc.getdocloc)? # Runtime default is an installation-specific stdlib path.
462+
460463
_?weakref\.CallableProxyType\.__getattr__ # Should have all attributes of proxy
461464
_?weakref\.(ref|ReferenceType)\.__init__ # C implementation has incorrect signature
462465
_?weakref\.(ref|ReferenceType)\.__call__ # C function default annotation is wrong

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
# ============================================
2-
# TODO: Allowlist entries that should be fixed
3-
# ============================================
4-
5-
_pyrepl.fancy_termios
6-
_pyrepl.unix_console
7-
_pyrepl.unix_eventqueue
8-
ctypes.c_double_complex._type_
9-
ctypes.c_float_complex._type_
10-
ctypes.c_longdouble_complex._type_
11-
os.NODEV
12-
os.__all__
13-
posix.NODEV
14-
readline.get_pre_input_hook
15-
16-
171
# =============================================================
182
# Allowlist entries that cannot or should not be fixed; >= 3.15
193
# =============================================================
204

5+
# Depends on the ncurses version used to build Python.
6+
(_curses.BUTTON5_CLICKED)?
7+
(_curses.BUTTON5_DOUBLE_CLICKED)?
8+
(_curses.BUTTON5_PRESSED)?
9+
(_curses.BUTTON5_RELEASED)?
10+
(_curses.BUTTON5_TRIPLE_CLICKED)?
11+
12+
# Platform/build availability differs across Darwin builds.
13+
(_socket.SO_BINDTODEVICE)?
14+
(errno.ENOTCAPABLE)?
15+
16+
# Depends on how readline was built.
17+
readline.get_pre_input_hook
18+
2119
# Internal implementation details of the sampling profiler.
2220
profiling.sampling.live_collector
2321
profiling.sampling.live_collector.collector

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@
66
# decimal falls back to _pydecimal with different runtime signatures.
77
decimal\..*
88
_decimal
9-
_pyrepl.fancy_termios
10-
_pyrepl.unix_console
11-
_pyrepl.unix_eventqueue
12-
ctypes.c_double_complex._type_
13-
ctypes.c_float_complex._type_
14-
ctypes.c_longdouble_complex._type_
159
os.AT_NO_AUTOMOUNT
1610
os.AT_STATX_DONT_SYNC
1711
os.AT_STATX_FORCE_SYNC
1812
os.AT_STATX_SYNC_AS_STAT
19-
os.NODEV
2013
os.STATX_ATIME
2114
os.STATX_BASIC_STATS
2215
os.STATX_BLOCKS
@@ -41,7 +34,6 @@ posix.AT_NO_AUTOMOUNT
4134
posix.AT_STATX_DONT_SYNC
4235
posix.AT_STATX_FORCE_SYNC
4336
posix.AT_STATX_SYNC_AS_STAT
44-
posix.NODEV
4537
posix.STATX_ATIME
4638
posix.STATX_BASIC_STATS
4739
posix.STATX_BLOCKS
@@ -59,13 +51,15 @@ posix.STATX_SIZE
5951
posix.STATX_TYPE
6052
posix.STATX_UID
6153
posix.statx
62-
readline.get_pre_input_hook
6354

6455

6556
# =============================================================
6657
# Allowlist entries that cannot or should not be fixed; >= 3.15
6758
# =============================================================
6859

60+
# Depends on how readline was built.
61+
readline.get_pre_input_hook
62+
6963
# Internal implementation details of the sampling profiler.
7064
profiling.sampling.live_collector
7165
profiling.sampling.live_collector.collector

stdlib/@tests/stubtest_allowlists/py315.txt

Lines changed: 129 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -12,143 +12,41 @@ _frozen_importlib_external.SourceFileLoader.source_to_code
1212
_frozen_importlib_external.SourceLoader.source_to_code
1313
_frozen_importlib_external._LoaderBasics.load_module
1414
_frozen_importlib_external.cache_from_source
15-
_pyrepl.base_eventqueue
16-
_pyrepl.commands
17-
_pyrepl.completing_reader
18-
_pyrepl.console
19-
_pyrepl.content
20-
_pyrepl.fancycompleter
21-
_pyrepl.historical_reader
22-
_pyrepl.input
23-
_pyrepl.keymap
24-
_pyrepl.layout
25-
_pyrepl.main
26-
_pyrepl.pager
27-
_pyrepl.reader
28-
_pyrepl.readline
29-
_pyrepl.render
30-
_pyrepl.simple_interact
31-
_pyrepl.terminfo
32-
_pyrepl.trace
33-
_pyrepl.types
34-
_pyrepl.utils
35-
_pyrepl.windows_console
36-
_pyrepl.windows_eventqueue
3715
_struct.Struct.pack_into
3816
_struct.pack
3917
_struct.pack_into
4018
_thread.RLock.__exit__
4119
_thread.lock.__exit__
42-
annotationlib.ForwardRef.__arg__
43-
annotationlib.ForwardRef.__ast_node__
44-
annotationlib.ForwardRef.__cell__
45-
annotationlib.ForwardRef.__code__
46-
annotationlib.ForwardRef.__extra_names__
47-
annotationlib.ForwardRef.__globals__
48-
annotationlib.ForwardRef.__init_subclass__
49-
annotationlib.ForwardRef.__owner__
50-
annotationlib.ForwardRef.__stringifier_dict__
51-
ast.type_param.__init__
52-
# base64.b64decode uses a private sentinel list as the default for parameters whose public types are bool/buffer.
53-
base64.b64decode
54-
codecs.backslashreplace_errors
55-
codecs.ignore_errors
56-
codecs.namereplace_errors
57-
codecs.replace_errors
58-
codecs.strict_errors
59-
codecs.xmlcharrefreplace_errors
60-
concurrent.interpreters._crossinterp.UNBOUND_ERROR
61-
concurrent.interpreters._crossinterp.UNBOUND_REMOVE
62-
concurrent.interpreters._crossinterp.UnboundItem.singleton
63-
concurrent.interpreters._crossinterp.classonly
64-
concurrent.interpreters._crossinterp.classonly.__class_getitem__
65-
concurrent.interpreters._crossinterp.classonly.__func__
66-
concurrent.interpreters._crossinterp.classonly.__get__
67-
concurrent.interpreters._crossinterp.classonly.__init__
68-
concurrent.interpreters._crossinterp.classonly.__isabstractmethod__
69-
concurrent.interpreters._crossinterp.classonly.__set_name__
70-
concurrent.interpreters._crossinterp.classonly.__wrapped__
7120
copy.deepcopy
7221
dataclasses._MISSING_TYPE
7322
dataclasses.MISSING
7423
dataclasses.field
7524
doctest.DocTestRunner.report_skip
7625
enum.__all__
77-
enum.auto.__init__
78-
enum.auto.value
79-
functools.partialmethod.__new__
80-
http.HTTPMethod.description
8126
importlib._abc.Loader.load_module
8227
importlib._bootstrap_external.NamespacePath
8328
importlib.abc.InspectLoader.source_to_code
8429
importlib.abc.MetaPathFinder.discover
8530
importlib.abc.PathEntryFinder.discover
86-
importlib.resources._common.files
8731
importlib.resources._common.package_to_anchor
88-
importlib.resources.abc.Traversable.open
89-
inspect._ParameterKind.description
90-
io.Reader.__class_getitem__
91-
io.Reader.read
92-
io.Writer.__class_getitem__
93-
io.Writer.write
9432
mailbox.Mailbox.__enter__
9533
mailbox.Mailbox.__exit__
9634
mailbox._ProxyFile.__class_getitem__
97-
multiprocessing.managers.BaseListProxy.clear
98-
multiprocessing.managers.BaseListProxy.copy
99-
multiprocessing.managers._BaseDictProxy.__iter__
100-
multiprocessing.managers._BaseDictProxy.__len__
101-
multiprocessing.managers._BaseDictProxy.__reversed__
102-
multiprocessing.managers._BaseDictProxy.clear
103-
multiprocessing.managers._BaseDictProxy.copy
104-
multiprocessing.managers._BaseDictProxy.items
105-
multiprocessing.managers._BaseDictProxy.keys
106-
multiprocessing.managers._BaseDictProxy.popitem
107-
multiprocessing.managers._BaseDictProxy.values
108-
multiprocessing.managers._BaseSetProxy.__iter__
109-
multiprocessing.managers._BaseSetProxy.__len__
110-
multiprocessing.managers._BaseSetProxy.clear
111-
multiprocessing.managers._BaseSetProxy.copy
112-
multiprocessing.managers._BaseSetProxy.pop
11335
multiprocessing.process.BaseProcess.__init__
114-
sre_compile
115-
sre_constants
116-
sre_parse
117-
sys.__jit
118-
sys._monitoring
119-
sys.last_exc
12036
threading.Condition.locked
12137
tkinter.Image.__iter__
12238
tkinter.Misc.__iter__
12339
tkinter.font.Font.__iter__
12440
tkinter.simpledialog.__all__
125-
types.MappingProxyType.get
126-
types.SimpleNamespace.__delattr__
127-
types.SimpleNamespace.__setattr__
128-
types.UnionType.__class_getitem__
129-
types.UnionType.__mro_entries__
130-
types.UnionType.__name__
131-
types.UnionType.__qualname__
132-
typing.LiteralString
133-
typing.NewType.__mro_entries__
134-
typing.ParamSpec.__mro_entries__
135-
typing.ParamSpecArgs.__mro_entries__
136-
typing.ParamSpecKwargs.__mro_entries__
137-
typing.SupportsAbs.__type_params__
138-
typing.SupportsRound.__type_params__
139-
typing.TypeVar.__mro_entries__
140-
typing.TypeVarTuple.__mro_entries__
141-
typing.Union
142-
typing._SpecialForm.__mro_entries__
14341
typing_extensions.__all__
144-
typing_extensions.Protocol
14542
xml.etree.ElementTree.__all__
14643

14744
# =============================================================
148-
# Allowlist entries that cannot or should not be fixed; >=3.15
45+
# Allowlist entries that cannot or should not be fixed; >= 3.15
14946
# =============================================================
15047

15148
# runtime default is a list object used as a sentinel
49+
base64.b64decode
15250
urllib.parse.urlunparse
15351
urllib.parse.urlunsplit
15452

@@ -191,3 +89,130 @@ tkinter.Pack.content
19189
tkinter.Pack.pack_content
19290
tkinter.Place.content
19391
tkinter.Place.place_content
92+
93+
94+
# =============================================================
95+
# Allowlist entries that cannot or should not be fixed; >= 3.14
96+
# =============================================================
97+
98+
# Undocumented private attributes
99+
.*\.ForwardRef\.__arg__
100+
.*\.ForwardRef\.__ast_node__
101+
.*\.ForwardRef\.__cell__
102+
.*\.ForwardRef\.__code__
103+
.*\.ForwardRef\.__extra_names__
104+
.*\.ForwardRef\.__globals__
105+
.*\.ForwardRef\.__init_subclass__
106+
.*\.ForwardRef\.__owner__
107+
.*\.ForwardRef\.__stringifier_dict__
108+
109+
# Runtime AST node runtime constructor behaviour is too loose.
110+
# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378).
111+
# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858).
112+
_?ast.type_param.__init__
113+
114+
# Decorator approximated by classmethod
115+
concurrent.interpreters._crossinterp.classonly.*
116+
# Method using this decorator
117+
concurrent.interpreters._crossinterp.UnboundItem.singleton
118+
119+
# object() sentinels at runtime represented by NewTypes in the stubs
120+
concurrent.interpreters._crossinterp.UNBOUND_ERROR
121+
concurrent.interpreters._crossinterp.UNBOUND_REMOVE
122+
123+
# Assigning `__new__` causes `func` not to get recognized.
124+
functools.partialmethod.__new__
125+
126+
# These protocols use ABC hackery at runtime.
127+
(io|typing_extensions)\.Reader\.__class_getitem__
128+
(io|typing_extensions)\.Reader\.read
129+
(io|typing_extensions)\.Writer\.__class_getitem__
130+
(io|typing_extensions)\.Writer\.write
131+
132+
# These multiprocessing proxy methods have *args, **kwargs signatures at runtime,
133+
# but have more precise (accurate) signatures in the stub.
134+
multiprocessing.managers.BaseListProxy.clear
135+
multiprocessing.managers.BaseListProxy.copy
136+
multiprocessing.managers._BaseDictProxy.__reversed__
137+
multiprocessing.managers._BaseSetProxy.__iter__
138+
multiprocessing.managers._BaseSetProxy.__len__
139+
multiprocessing.managers._BaseSetProxy.clear
140+
multiprocessing.managers._BaseSetProxy.copy
141+
multiprocessing.managers._BaseSetProxy.pop
142+
143+
# Union and UnionType are aliases in 3.14 but type checkers need some changes.
144+
typing.Union
145+
types.UnionType.__class_getitem__
146+
types.UnionType.__mro_entries__
147+
types.UnionType.__name__
148+
types.UnionType.__qualname__
149+
150+
151+
# =============================================================
152+
# Allowlist entries that cannot or should not be fixed; >= 3.13
153+
# =============================================================
154+
155+
_pyrepl\..+ # The internal implementation of the REPL on py313+; not for public consumption
156+
codecs.backslashreplace_errors # Runtime incorrectly has `self`
157+
codecs.ignore_errors # Runtime incorrectly has `self`
158+
codecs.namereplace_errors # Runtime incorrectly has `self`
159+
codecs.replace_errors # Runtime incorrectly has `self`
160+
codecs.strict_errors # Runtime incorrectly has `self`
161+
codecs.xmlcharrefreplace_errors # Runtime incorrectly has `self`
162+
163+
# These multiprocessing proxy methods have *args, **kwargs signatures at runtime,
164+
# but have more precise (accurate) signatures in the stub.
165+
multiprocessing.managers._BaseDictProxy.__iter__
166+
multiprocessing.managers._BaseDictProxy.__len__
167+
multiprocessing.managers._BaseDictProxy.clear
168+
multiprocessing.managers._BaseDictProxy.copy
169+
multiprocessing.managers._BaseDictProxy.items
170+
multiprocessing.managers._BaseDictProxy.keys
171+
multiprocessing.managers._BaseDictProxy.popitem
172+
multiprocessing.managers._BaseDictProxy.values
173+
174+
# To match `dict`, we lie about the runtime, but use overloads to match the correct behavior.
175+
types.MappingProxyType.get
176+
177+
typing_extensions.Protocol # Super-special typing primitive
178+
179+
180+
# =============================================================
181+
# Allowlist entries that cannot or should not be fixed; >= 3.12
182+
# =============================================================
183+
184+
# Deprecated argument is supported at runtime by renaming it through a decorator.
185+
importlib.resources._common.files
186+
187+
sys._monitoring # Doesn't really exist. See comments in the stub.
188+
sys.__jit # Similar to sys._monitoring
189+
sys.last_exc # Not always defined.
190+
191+
# Types that require `__setattr__` and `__delattr__` for typing purposes.
192+
types.SimpleNamespace.__delattr__
193+
types.SimpleNamespace.__setattr__
194+
195+
# These only exist to give a better error message if you try to subclass an instance.
196+
typing.ParamSpec.__mro_entries__
197+
typing.ParamSpecArgs.__mro_entries__
198+
typing.ParamSpecKwargs.__mro_entries__
199+
typing.TypeVar.__mro_entries__
200+
typing.TypeVarTuple.__mro_entries__
201+
202+
# These exist at runtime because the protocol uses PEP 695 syntax in CPython.
203+
typing.SupportsAbs.__type_params__
204+
typing.SupportsRound.__type_params__
205+
206+
207+
# =============================================================
208+
# Allowlist entries that cannot or should not be fixed; >= 3.11
209+
# =============================================================
210+
211+
enum.auto.__init__ # The stub for enum.auto is nothing like the implementation
212+
enum.auto.value # The stub for enum.auto is nothing like the implementation
213+
http.HTTPMethod.description # Mutable instance attribute at runtime but we pretend it's a property
214+
importlib.resources.abc.Traversable.open # Problematic protocol signature at runtime, see source code comments.
215+
inspect._ParameterKind.description # Still exists, but stubtest can't see it
216+
typing.LiteralString # Super-special typing primitive
217+
typing.NewType.__mro_entries__ # Only exists for an error message.
218+
typing._SpecialForm.__mro_entries__ # Super-special typing primitive

stdlib/@tests/stubtest_allowlists/win32-py315.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,17 @@ _winapi.EVENTLOG_WARNING_TYPE
1212
_winapi.GetOEMCP
1313
_winapi.RegisterEventSource
1414
_winapi.ReportEvent
15-
asyncio.windows_events.IocpProactor.finish_socket_func
1615
winreg.DeleteTree
16+
17+
18+
# =============================================================
19+
# Allowlist entries that cannot or should not be fixed; >= 3.15
20+
# =============================================================
21+
22+
# Depends on whether the C _decimal extension or pure-Python fallback is used.
23+
(_decimal.SPEC_VERSION)?
24+
(decimal.SPEC_VERSION)?
25+
26+
# Undocumented internal method, not really for public consumption.
27+
# Hard to add types for unless we add stubs for the undocumented _overlapped module.
28+
asyncio.windows_events.IocpProactor.finish_socket_func

stdlib/VERSIONS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@ socket: 3.0-
281281
socketserver: 3.0-
282282
spwd: 3.0-3.12
283283
sqlite3: 3.0-
284-
sre_compile: 3.0-
285-
sre_constants: 3.0-
286-
sre_parse: 3.0-
284+
sre_compile: 3.0-3.14
285+
sre_constants: 3.0-3.14
286+
sre_parse: 3.0-3.14
287287
ssl: 3.0-
288288
stat: 3.0-
289289
statistics: 3.4-

0 commit comments

Comments
 (0)