Skip to content

Commit cc2f7d5

Browse files
committed
Merge upstream/main into python315
2 parents 10bb878 + 4e1948a commit cc2f7d5

83 files changed

Lines changed: 1212 additions & 1031 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ repos:
3636
- id: flake8
3737
language: python
3838
additional_dependencies:
39-
- "flake8-pyi==25.5.0"
39+
- "flake8-pyi==26.5.0"
4040
types: [file]
4141
types_or: [python, pyi]
4242
- repo: meta

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ unittest.runner._WritelnDecorator.write # Methods that come from __getattr__()
464464
urllib.response.addbase.write # Methods that come from __getattr__() at runtime
465465
urllib.response.addbase.writelines # Methods that come from __getattr__() at runtime
466466

467-
(pydoc.Doc.getdocloc)? # Runtime default is an installation-specific stdlib path.
468467
(hashlib.__all__)? # scrypt depends on how OpenSSL was built.
468+
(pydoc.Doc.getdocloc)? # Runtime default is an installation-specific stdlib path.
469469

470470
_?weakref\.CallableProxyType\.__getattr__ # Should have all attributes of proxy
471471
_?weakref\.(ref|ReferenceType)\.__init__ # C implementation has incorrect signature

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# ============================================
2+
# TODO: Allowlist entries that should be fixed
3+
# ============================================
4+
15
_pyrepl.fancy_termios
26
_pyrepl.unix_console
37
_pyrepl.unix_eventqueue
@@ -14,10 +18,17 @@ ctypes.c_longdouble_complex._type_
1418
os.NODEV
1519
os.__all__
1620
posix.NODEV
21+
readline.get_pre_input_hook
22+
23+
24+
# =============================================================
25+
# Allowlist entries that cannot or should not be fixed; >= 3.15
26+
# =============================================================
27+
28+
# Internal implementation details of the sampling profiler.
1729
profiling.sampling.live_collector
1830
profiling.sampling.live_collector.collector
1931
profiling.sampling.live_collector.constants
2032
profiling.sampling.live_collector.display
2133
profiling.sampling.live_collector.trend_tracker
2234
profiling.sampling.live_collector.widgets
23-
readline.get_pre_input_hook

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

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1+
# ============================================
2+
# TODO: Allowlist entries that should be fixed
3+
# ============================================
4+
5+
# GitHub Actions' Python 3.15 Linux build currently lacks _decimal, so
6+
# decimal falls back to _pydecimal with different runtime signatures.
7+
decimal\..*
18
_decimal
29
_pyrepl.fancy_termios
310
_pyrepl.unix_console
411
_pyrepl.unix_eventqueue
5-
(_socket.CAN_ISOTP_LL_OPTS)?
6-
(_socket.CAN_ISOTP_OPTS)?
7-
(_socket.CAN_ISOTP_RECV_FC)?
8-
(_socket.CAN_ISOTP_RX_STMIN)?
9-
(_socket.CAN_ISOTP_TX_STMIN)?
10-
(_socket.SOL_CAN_ISOTP)?
1112
ctypes.c_double_complex._type_
1213
ctypes.c_float_complex._type_
1314
ctypes.c_longdouble_complex._type_
14-
# GitHub Actions' Python 3.15 Linux build currently lacks _decimal, so
15-
# decimal falls back to _pydecimal with different runtime signatures.
16-
decimal\..*
17-
(mmap.mmap.madvise)?
1815
os.AT_NO_AUTOMOUNT
1916
os.AT_STATX_DONT_SYNC
2017
os.AT_STATX_FORCE_SYNC
@@ -62,19 +59,17 @@ posix.STATX_SIZE
6259
posix.STATX_TYPE
6360
posix.STATX_UID
6461
posix.statx
62+
readline.get_pre_input_hook
63+
64+
65+
# =============================================================
66+
# Allowlist entries that cannot or should not be fixed; >= 3.15
67+
# =============================================================
68+
69+
# Internal implementation details of the sampling profiler.
6570
profiling.sampling.live_collector
6671
profiling.sampling.live_collector.collector
6772
profiling.sampling.live_collector.constants
6873
profiling.sampling.live_collector.display
6974
profiling.sampling.live_collector.trend_tracker
7075
profiling.sampling.live_collector.widgets
71-
readline.get_pre_input_hook
72-
(resource.RLIM_SAVED_CUR)?
73-
(resource.RLIM_SAVED_MAX)?
74-
(socket.CAN_ISOTP_LL_OPTS)?
75-
(socket.CAN_ISOTP_OPTS)?
76-
(socket.CAN_ISOTP_RECV_FC)?
77-
(socket.CAN_ISOTP_RX_STMIN)?
78-
(socket.CAN_ISOTP_TX_STMIN)?
79-
(socket.SOL_CAN_ISOTP)?
80-
(socket.__all__)?
Lines changed: 97 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
# =========================
2-
# New errors in Python 3.15
3-
# =========================
1+
# ============================================
2+
# TODO: Allowlist entries that should be fixed
3+
# ============================================
44

5-
(os.NODEV)?
6-
(posix.NODEV)?
7-
(resource.RLIMIT_NTHR)?
8-
(resource.RLIMIT_THREADS)?
9-
(resource.RLIMIT_UMTXP)?
10-
11-
# Importlib exposes deprecated or implementation-detail runtime APIs that the stubs deliberately omit or tighten.
125
_frozen_importlib.BuiltinImporter.load_module
136
_frozen_importlib.FrozenImporter.load_module
147
_frozen_importlib_external.FileFinder.discover
@@ -19,29 +12,33 @@ _frozen_importlib_external.SourceFileLoader.source_to_code
1912
_frozen_importlib_external.SourceLoader.source_to_code
2013
_frozen_importlib_external._LoaderBasics.load_module
2114
_frozen_importlib_external.cache_from_source
22-
importlib._abc.Loader.load_module
23-
importlib._bootstrap_external.NamespacePath
24-
importlib.abc.InspectLoader.source_to_code
25-
importlib.abc.MetaPathFinder.discover
26-
importlib.abc.PathEntryFinder.discover
27-
28-
# The internal implementation of the REPL on py313+; not for public consumption.
29-
_pyrepl\..+
30-
31-
# Argument Clinic and C variadic signatures are intentionally more precise in the stubs.
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
3237
_struct.Struct.pack_into
3338
_struct.pack
3439
_struct.pack_into
35-
ctypes.SetPointerType
36-
marshal.dump
37-
marshal.dumps
38-
symtable.symtable
39-
40-
# Context manager __exit__ signatures are runtime implementation details; the stubs follow the protocol.
4140
_thread.RLock.__exit__
4241
_thread.lock.__exit__
43-
44-
# Undocumented private attributes on ForwardRef; same policy as py314.
4542
annotationlib.ForwardRef.__arg__
4643
annotationlib.ForwardRef.__ast_node__
4744
annotationlib.ForwardRef.__cell__
@@ -50,86 +47,53 @@ annotationlib.ForwardRef.__extra_names__
5047
annotationlib.ForwardRef.__globals__
5148
annotationlib.ForwardRef.__init_subclass__
5249
annotationlib.ForwardRef.__owner__
53-
annotationlib.ForwardRef.__resolved_str__
54-
annotationlib.ForwardRef.__resolved_str_cache__
55-
annotationlib.ForwardRef.__slots__
5650
annotationlib.ForwardRef.__stringifier_dict__
57-
58-
# Static constructor behavior remains intentionally stricter for runtime AST helpers.
5951
ast.type_param.__init__
60-
61-
# Runtime incorrectly has `self`; same policy as py314.
52+
# base64.b64decode uses a private sentinel list as the default for parameters whose public types are bool/buffer.
53+
base64.b64decode
6254
codecs.backslashreplace_errors
6355
codecs.ignore_errors
6456
codecs.namereplace_errors
6557
codecs.replace_errors
6658
codecs.strict_errors
6759
codecs.xmlcharrefreplace_errors
68-
69-
# Decorator/runtime sentinel implementation details; same policy as py314.
7060
concurrent.interpreters._crossinterp.UNBOUND_ERROR
7161
concurrent.interpreters._crossinterp.UNBOUND_REMOVE
7262
concurrent.interpreters._crossinterp.UnboundItem.singleton
73-
concurrent.interpreters._crossinterp.classonly.*
74-
75-
# object() sentinels and overloaded helper defaults are modeled more usefully in the stubs.
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__
7671
copy.deepcopy
77-
dataclasses.MISSING
7872
dataclasses._MISSING_TYPE
73+
dataclasses.MISSING
7974
dataclasses.field
80-
81-
# Runtime defaults/sentinels are not expressible without losing useful static signatures.
8275
doctest.DocTestRunner.report_skip
83-
functools.partialmethod.__new__
84-
gzip.compress
85-
importlib.resources._common.files
86-
importlib.resources._common.package_to_anchor
87-
inspect.getfullargspec
88-
multiprocessing.context.BaseContext.set_forkserver_preload
89-
multiprocessing.forkserver.ForkServer.set_forkserver_preload
90-
pdb.Pdb.print_stack_entry
91-
pkgutil.resolve_name
92-
pprint.PrettyPrinter.__init__
93-
pprint.pformat
94-
pprint.pprint
95-
site.addsitedir
96-
site.addsitepackages
97-
site.addusersitepackages
98-
site.process_startup_files
99-
100-
# The stub for enum.auto is nothing like the implementation; same policy as py314.
10176
enum.__all__
10277
enum.auto.__init__
10378
enum.auto.value
104-
105-
# Complex ctypes scalar runtime metadata is not useful for static checking.
106-
(ctypes.c_double_complex._type_)?
107-
(ctypes.c_float_complex._type_)?
108-
(ctypes.c_longdouble_complex._type_)?
109-
110-
# Runtime metadata/export lists changed, but the stubs expose the supported API surface.
79+
functools.partialmethod.__new__
11180
http.HTTPMethod.description
112-
inspect._ParameterKind.description
113-
(os.__all__)?
114-
sys.last_exc
115-
threading.Condition.locked
116-
typing_extensions.__all__
117-
xml.etree.ElementTree.__all__
118-
119-
# Problematic protocol signatures at runtime; same policy as py314.
81+
importlib._abc.Loader.load_module
82+
importlib._bootstrap_external.NamespacePath
83+
importlib.abc.InspectLoader.source_to_code
84+
importlib.abc.MetaPathFinder.discover
85+
importlib.abc.PathEntryFinder.discover
86+
importlib.resources._common.files
87+
importlib.resources._common.package_to_anchor
12088
importlib.resources.abc.Traversable.open
121-
(io|typing_extensions)\.Reader\.__class_getitem__
122-
(io|typing_extensions)\.Reader\.read
123-
(io|typing_extensions)\.Writer\.__class_getitem__
124-
(io|typing_extensions)\.Writer\.write
125-
126-
# Runtime context-manager/proxy wrappers are loose; stubs retain the useful public protocol.
89+
inspect._ParameterKind.description
90+
io.Reader.__class_getitem__
91+
io.Reader.read
92+
io.Writer.__class_getitem__
93+
io.Writer.write
12794
mailbox.Mailbox.__enter__
12895
mailbox.Mailbox.__exit__
12996
mailbox._ProxyFile.__class_getitem__
130-
131-
# These multiprocessing proxy methods have *args, **kwargs signatures at runtime,
132-
# but have more precise signatures in the stubs; same policy as py314.
13397
multiprocessing.managers.BaseListProxy.clear
13498
multiprocessing.managers.BaseListProxy.copy
13599
multiprocessing.managers._BaseDictProxy.__iter__
@@ -147,39 +111,17 @@ multiprocessing.managers._BaseSetProxy.clear
147111
multiprocessing.managers._BaseSetProxy.copy
148112
multiprocessing.managers._BaseSetProxy.pop
149113
multiprocessing.process.BaseProcess.__init__
150-
151-
# Runtime path APIs include implementation hooks/deprecated behavior that the stubs intentionally hide or tighten.
152-
(ntpath.realpath)?
153-
154-
# base64.b64decode uses a private sentinel list as the default for parameters whose public types are bool/buffer.
155-
base64.b64decode
156-
157-
# New profiling package internals are not part of the typed public surface.
158-
profiling\.sampling\..+
159-
160-
# readline hook availability is build-dependent.
161-
(readline.get_pre_input_hook)?
162-
163-
# Doesn't really exist, or is hidden behind implementation guards; see comments in the sys stub.
164114
sys.__jit
165115
sys._monitoring
166-
167-
# Tkinter runtime mixins expose Tcl container behavior that is not part of the typed public API.
168-
tkinter.Grid.content
116+
sys.last_exc
117+
threading.Condition.locked
169118
tkinter.Image.__iter__
170119
tkinter.Misc.__iter__
171-
tkinter.Misc.content
172-
tkinter.Pack.content
173-
tkinter.Place.content
174120
tkinter.font.Font.__iter__
175121
tkinter.simpledialog.__all__
176-
177-
# Runtime attribute mutability differs from the useful static model; same policy as py314.
178122
types.MappingProxyType.get
179123
types.SimpleNamespace.__delattr__
180124
types.SimpleNamespace.__setattr__
181-
182-
# Super-special typing primitives and runtime aliases; same policy as py314.
183125
types.UnionType.__class_getitem__
184126
types.UnionType.__mro_entries__
185127
types.UnionType.__name__
@@ -195,4 +137,50 @@ typing.TypeVar.__mro_entries__
195137
typing.TypeVarTuple.__mro_entries__
196138
typing.Union
197139
typing._SpecialForm.__mro_entries__
140+
typing_extensions.__all__
198141
typing_extensions.Protocol
142+
xml.etree.ElementTree.__all__
143+
144+
# =============================================================
145+
# Allowlist entries that cannot or should not be fixed; >=3.15
146+
# =============================================================
147+
148+
# runtime default is a list object used as a sentinel
149+
urllib.parse.urlunparse
150+
urllib.parse.urlunsplit
151+
152+
# Internal implementation details of the sampling profiler.
153+
profiling.sampling.binary_collector
154+
profiling.sampling.binary_reader
155+
profiling.sampling.cli
156+
profiling.sampling.constants
157+
profiling.sampling.dump
158+
profiling.sampling.errors
159+
profiling.sampling.gecko_collector.CATEGORY_CODE_TYPE
160+
profiling.sampling.gecko_collector.CATEGORY_CPU
161+
profiling.sampling.gecko_collector.CATEGORY_EXCEPTION
162+
profiling.sampling.gecko_collector.CATEGORY_GC
163+
profiling.sampling.gecko_collector.CATEGORY_GIL
164+
profiling.sampling.gecko_collector.CATEGORY_NATIVE
165+
profiling.sampling.gecko_collector.CATEGORY_OPCODES
166+
profiling.sampling.gecko_collector.CATEGORY_OTHER
167+
profiling.sampling.gecko_collector.CATEGORY_PYTHON
168+
profiling.sampling.gecko_collector.DEFAULT_SUBCATEGORY
169+
profiling.sampling.gecko_collector.FRAME_ADDRESS_NONE
170+
profiling.sampling.gecko_collector.FRAME_INLINE_DEPTH_ROOT
171+
profiling.sampling.gecko_collector.GECKO_CATEGORIES
172+
profiling.sampling.gecko_collector.GECKO_FORMAT_VERSION
173+
profiling.sampling.gecko_collector.GECKO_PREPROCESSED_VERSION
174+
profiling.sampling.gecko_collector.PROCESS_TYPE_MAIN
175+
profiling.sampling.gecko_collector.RESOURCE_TYPE_LIBRARY
176+
profiling.sampling.gecko_collector.STACKWALK_DISABLED
177+
profiling.sampling.heatmap_collector.FileStats
178+
profiling.sampling.heatmap_collector.TreeNode
179+
profiling.sampling.module_utils
180+
profiling.sampling.opcode_utils
181+
profiling.sampling.sample
182+
183+
# These conflicting aliases are just like tkinter.*.slaves in common.txt.
184+
tkinter.Grid.content
185+
tkinter.Pack.content
186+
tkinter.Place.content

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# ============================================
2+
# TODO: Allowlist entries that should be fixed
3+
# ============================================
4+
15
(_decimal.SPEC_VERSION)?
26
_winapi.DeregisterEventSource
37
_winapi.EVENTLOG_AUDIT_FAILURE

stdlib/VERSIONS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ _py_abc: 3.7-
6060
_pydecimal: 3.5-
6161
_queue: 3.7-
6262
_random: 3.0-
63+
_remote_debugging: 3.15-
6364
_sitebuiltins: 3.4-
6465
_socket: 3.0- # present in 3.0 at runtime, but not in typeshed
6566
_sqlite3: 3.0-

0 commit comments

Comments
 (0)