Skip to content

Commit 73fc432

Browse files
ambvmeta-codesync[bot]
authored andcommitted
Sync pre-release CPython 3.15 branch from GitHub (2026-06-09)
Summary: Imported python/cpython `3.15.0b2+dev` from upstream rev [`73e5d44`](https://www.github.com/python/cpython/commit/73e5d444ac4f0801074c3a27271070774ff88b62) (committed 2026-06-09 23:33:04+00:00). # Commit Info - Base: (`3.15.0b2+dev`) - [`83e26a4`](https://www.github.com/python/cpython/commit/83e26a43a7598ef55a4f9b0bd793b029071d3ed4) (commit date: 2026-06-08 22:55:57+00:00) - Imported: (`3.15.0b2+dev`) - [`73e5d44`](https://www.github.com/python/cpython/commit/73e5d444ac4f0801074c3a27271070774ff88b62) (commit date: 2026-06-09 23:33:04+00:00) # Noteworthy file changes - Native files (2 added): ``` + Modules/_testcapi/weakref.c + Modules/_testlimitedcapi/weakref.c ``` - Test files (1 added) - Low-signal files (12 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GAx6JSjYPAC5MWAFAH9-zWjuWKBjbr0LAAAz Reviewed By: itamaro Differential Revision: D108108267 fbshipit-source-id: 0b447911a0f74f492da68d8e295ec241f5cbc3cd
1 parent 656f699 commit 73fc432

62 files changed

Lines changed: 736 additions & 287 deletions

File tree

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,13 @@ jobs:
325325
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
326326
# supported by important vendors such as AWS-LC.
327327
- { name: openssl, version: 1.1.1w }
328-
- { name: openssl, version: 3.0.20 }
329-
- { name: openssl, version: 3.3.7 }
330-
- { name: openssl, version: 3.4.5 }
331-
- { name: openssl, version: 3.5.6 }
332-
- { name: openssl, version: 3.6.2 }
333-
- { name: openssl, version: 4.0.0 }
328+
- { name: openssl, version: 3.0.21 }
329+
- { name: openssl, version: 3.4.6 }
330+
- { name: openssl, version: 3.5.7 }
331+
- { name: openssl, version: 3.6.3 }
332+
- { name: openssl, version: 4.0.1 }
334333
## AWS-LC
335-
- { name: aws-lc, version: 1.72.1 }
334+
- { name: aws-lc, version: 5.0.0 }
336335
env:
337336
SSLLIB_VER: ${{ matrix.ssllib.version }}
338337
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -446,7 +445,7 @@ jobs:
446445
needs: build-context
447446
if: needs.build-context.outputs.run-ubuntu == 'true'
448447
env:
449-
OPENSSL_VER: 3.5.6
448+
OPENSSL_VER: 3.5.7
450449
PYTHONSTRICTEXTENSIONBUILD: 1
451450
steps:
452451
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -554,7 +553,7 @@ jobs:
554553
matrix:
555554
os: [ubuntu-24.04]
556555
env:
557-
OPENSSL_VER: 3.5.6
556+
OPENSSL_VER: 3.5.7
558557
PYTHONSTRICTEXTENSIONBUILD: 1
559558
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
560559
steps:

.github/workflows/reusable-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ${{ inputs.os }}
3636
timeout-minutes: 60
3737
env:
38-
OPENSSL_VER: 3.5.6
38+
OPENSSL_VER: 3.5.7
3939
PYTHONSTRICTEXTENSIONBUILD: 1
4040
TERM: linux
4141
steps:

Doc/library/argparse.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,8 @@ is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar']``.
442442

443443
.. note::
444444

445-
Empty lines are treated as empty strings (``''``), which are allowed as values but
446-
not as arguments. Empty lines that are read as arguments will result in an
447-
"unrecognized arguments" error.
445+
Each line is treated as a single argument, so an empty line is read as an
446+
empty string (``''``).
448447

449448
:class:`ArgumentParser` uses :term:`filesystem encoding and error handler`
450449
to read the file containing arguments.
@@ -1052,6 +1051,10 @@ is used when no command-line argument was present::
10521051
>>> parser.parse_args([])
10531052
Namespace(foo=42)
10541053

1054+
Because ``nargs='*'`` gathers any supplied values into a list, an absent
1055+
positional argument yields an empty list (``[]``). Only a non-``None``
1056+
*default* overrides this (so ``default=None`` still gives ``[]``).
1057+
10551058
For required_ arguments, the ``default`` value is ignored. For example, this
10561059
applies to positional arguments with nargs_ values other than ``?`` or ``*``,
10571060
or optional arguments marked as ``required=True``.
@@ -1369,6 +1372,11 @@ behavior::
13691372
>>> parser.parse_args('--foo XXX'.split())
13701373
Namespace(bar='XXX')
13711374

1375+
Multiple arguments may share the same ``dest``. By default, the value from the
1376+
last such argument given on the command line wins. Use ``action='append'`` to
1377+
collect values from all of them into a list instead. For conflicting *option
1378+
strings* rather than ``dest`` names, see conflict_handler_.
1379+
13721380
.. versionchanged:: 3.15
13731381
Single-dash long option now takes precedence over short options.
13741382

@@ -1777,6 +1785,11 @@ Subcommands
17771785
present, and when the ``b`` command is specified, only the ``foo`` and
17781786
``baz`` attributes are present.
17791787

1788+
If a subparser defines an argument with the same ``dest`` as the parent
1789+
parser, the two share a single namespace attribute, so the parent's value
1790+
won't be retained. Users should give them distinct ``dest`` values to
1791+
keep both.
1792+
17801793
Similarly, when a help message is requested from a subparser, only the help
17811794
for that particular parser will be printed. The help message will not
17821795
include parent parser or sibling parser messages. (A help message for each
@@ -2232,6 +2245,9 @@ Customizing file parsing
22322245
def convert_arg_line_to_args(self, arg_line):
22332246
return arg_line.split()
22342247

2248+
Note that with this override an argument can no longer contain spaces, since
2249+
each space-separated word becomes a separate argument.
2250+
22352251

22362252
Exiting methods
22372253
^^^^^^^^^^^^^^^

Doc/library/shutil.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,14 @@ Directory and files operations
385385
If *dst* already exists but is not a directory, it may be overwritten
386386
depending on :func:`os.rename` semantics.
387387

388-
If the destination is on the current filesystem, then :func:`os.rename` is
389-
used. Otherwise, *src* is copied to the destination using *copy_function*
390-
and then removed. In case of symlinks, a new symlink pointing to the target
391-
of *src* will be created as the destination and *src* will be removed.
388+
:func:`os.rename` is preferably used internally when *src* and the destination are on
389+
the same filesystem. In case :func:`os.rename` fails due to :exc:`OSError`
390+
(e.g. the user has write permission to the destination file but not to its parent
391+
directory), this method falls back to using *copy_function*, in which case
392+
*src* is copied to the destination using *copy_function* and then removed.
393+
394+
In case of symlinks, a new symlink pointing to the target of *src* will be
395+
created in or as the destination, and *src* will be removed.
392396

393397
If *copy_function* is given, it must be a callable that takes two arguments,
394398
*src* and the destination, and will be used to copy *src* to the destination

Doc/tools/extensions/profiling_trace.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,15 @@ def inject_trace(app, exception):
154154
)
155155

156156

157+
def add_assets(app, pagename, templatename, context, doctree):
158+
if pagename == 'library/profiling.sampling':
159+
app.add_js_file('profiling-sampling-visualization.js')
160+
app.add_css_file('profiling-sampling-visualization.css')
161+
162+
157163
def setup(app):
158164
app.connect('build-finished', inject_trace)
159-
app.add_js_file('profiling-sampling-visualization.js')
160-
app.add_css_file('profiling-sampling-visualization.css')
165+
app.connect('html-page-context', add_assets)
161166

162167
return {
163168
'version': '1.0',

Lib/asyncio/base_events.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,10 @@ def set_task_factory(self, factory):
487487
If factory is None the default task factory will be set.
488488
489489
If factory is a callable, it should have a signature matching
490-
'(loop, coro, **kwargs)', where 'loop' will be a reference to the active
491-
event loop, 'coro' will be a coroutine object, and **kwargs will be
492-
arbitrary keyword arguments that should be passed on to Task.
493-
The callable must return a Task.
490+
'(loop, coro, **kwargs)', where 'loop' will be a reference to the
491+
active event loop, 'coro' will be a coroutine object, and **kwargs
492+
will be arbitrary keyword arguments that should be passed on to
493+
Task. The callable must return a Task.
494494
"""
495495
if factory is not None and not callable(factory):
496496
raise TypeError('task factory must be a callable or None')
@@ -726,8 +726,8 @@ def run_until_complete(self, future):
726726
def stop(self):
727727
"""Stop running the event loop.
728728
729-
Every callback already scheduled will still run. This simply informs
730-
run_forever to stop looping after a complete iteration.
729+
Every callback already scheduled will still run. This simply
730+
informs run_forever to stop looping after a complete iteration.
731731
"""
732732
self._stopping = True
733733

@@ -1075,12 +1075,12 @@ async def create_connection(
10751075
10761076
Create a streaming transport connection to a given internet host and
10771077
port: socket family AF_INET or socket.AF_INET6 depending on host (or
1078-
family if specified), socket type SOCK_STREAM. protocol_factory must be
1079-
a callable returning a protocol instance.
1078+
family if specified), socket type SOCK_STREAM. protocol_factory must
1079+
be a callable returning a protocol instance.
10801080
1081-
This method is a coroutine which will try to establish the connection
1082-
in the background. When successful, the coroutine returns a
1083-
(transport, protocol) pair.
1081+
This method is a coroutine which will try to establish the
1082+
connection in the background. When successful, the coroutine
1083+
returns a (transport, protocol) pair.
10841084
"""
10851085
if server_hostname is not None and not ssl:
10861086
raise ValueError('server_hostname is only meaningful with ssl')
@@ -1549,11 +1549,11 @@ async def create_server(
15491549
The host parameter can be a string, in that case the TCP server is
15501550
bound to host and port.
15511551
1552-
The host parameter can also be a sequence of strings and in that case
1553-
the TCP server is bound to all hosts of the sequence. If a host
1554-
appears multiple times (possibly indirectly e.g. when hostnames
1555-
resolve to the same IP address), the server is only bound once to that
1556-
host.
1552+
The host parameter can also be a sequence of strings and in that
1553+
case the TCP server is bound to all hosts of the sequence. If
1554+
a host appears multiple times (possibly indirectly e.g. when
1555+
hostnames resolve to the same IP address), the server is only bound
1556+
once to that host.
15571557
15581558
Return a Server object which can be used to stop the service.
15591559

Lib/asyncio/events.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ async def create_server(
374374
375375
If host is an empty string or None all interfaces are assumed
376376
and a list of multiple sockets will be returned (most likely
377-
one for IPv4 and another one for IPv6). The host parameter can also be
378-
a sequence (e.g. list) of hosts to bind to.
377+
one for IPv4 and another one for IPv6). The host parameter can also
378+
be a sequence (e.g. list) of hosts to bind to.
379379
380380
family can be set to either AF_INET or AF_INET6 to force the
381381
socket to use IPv4 or IPv6. If not set it will be determined
@@ -415,8 +415,9 @@ async def create_server(
415415
416416
start_serving set to True (default) causes the created server
417417
to start accepting connections immediately. When set to False,
418-
the user should await Server.start_serving() or Server.serve_forever()
419-
to make the server to start accepting connections.
418+
the user should await Server.start_serving() or
419+
Server.serve_forever() to make the server to start accepting
420+
connections.
420421
"""
421422
raise NotImplementedError
422423

@@ -479,8 +480,9 @@ async def create_unix_server(
479480
480481
start_serving set to True (default) causes the created server
481482
to start accepting connections immediately. When set to False,
482-
the user should await Server.start_serving() or Server.serve_forever()
483-
to make the server to start accepting connections.
483+
the user should await Server.start_serving() or
484+
Server.serve_forever() to make the server to start accepting
485+
connections.
484486
"""
485487
raise NotImplementedError
486488

@@ -511,8 +513,8 @@ async def create_datagram_endpoint(self, protocol_factory,
511513
512514
protocol_factory must be a callable returning a protocol instance.
513515
514-
socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on
515-
host (or family if specified), socket type SOCK_DGRAM.
516+
socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending
517+
on host (or family if specified), socket type SOCK_DGRAM.
516518
517519
reuse_address tells the kernel to reuse a local socket in
518520
TIME_WAIT state, without waiting for its natural timeout to
@@ -552,7 +554,8 @@ async def connect_read_pipe(self, protocol_factory, pipe):
552554
async def connect_write_pipe(self, protocol_factory, pipe):
553555
"""Register write pipe in event loop.
554556
555-
protocol_factory should instantiate object with BaseProtocol interface.
557+
protocol_factory should instantiate object with BaseProtocol
558+
interface.
556559
Pipe is file-like object already switched to nonblocking.
557560
Return pair (transport, protocol), where transport support
558561
WriteTransport interface."""

Lib/asyncio/graph.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ def capture_call_graph(
112112
optional keyword-only 'depth' argument can be used to skip the specified
113113
number of frames from top of the stack.
114114
115-
If the optional keyword-only 'limit' argument is provided, each call stack
116-
in the resulting graph is truncated to include at most ``abs(limit)``
117-
entries. If 'limit' is positive, the entries left are the closest to
118-
the invocation point. If 'limit' is negative, the topmost entries are
119-
left. If 'limit' is omitted or None, all entries are present.
120-
If 'limit' is 0, the call stack is not captured at all, only
121-
"awaited by" information is present.
115+
If the optional keyword-only 'limit' argument is provided, each call
116+
stack in the resulting graph is truncated to include at most
117+
``abs(limit)`` entries. If 'limit' is positive, the entries left are
118+
the closest to the invocation point. If 'limit' is negative, the
119+
topmost entries are left. If 'limit' is omitted or None, all entries
120+
are present. If 'limit' is 0, the call stack is not captured at all,
121+
only "awaited by" information is present.
122122
"""
123123

124124
loop = events._get_running_loop()

Lib/asyncio/locks.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ def _wake_up_first(self):
158158
class Event(mixins._LoopBoundMixin):
159159
"""Asynchronous equivalent to threading.Event.
160160
161-
Class implementing event objects. An event manages a flag that can be set
162-
to true with the set() method and reset to false with the clear() method.
163-
The wait() method blocks until the flag is true. The flag is initially
164-
false.
161+
Class implementing event objects. An event manages a flag that can be
162+
set to true with the set() method and reset to false with the clear()
163+
method. The wait() method blocks until the flag is true. The flag is
164+
initially false.
165165
"""
166166

167167
def __init__(self):
@@ -353,9 +353,9 @@ class Semaphore(_ContextManagerMixin, mixins._LoopBoundMixin):
353353
"""A Semaphore implementation.
354354
355355
A semaphore manages an internal counter which is decremented by each
356-
acquire() call and incremented by each release() call. The counter
357-
can never go below zero; when acquire() finds that it is zero, it blocks,
358-
waiting until some other thread calls release().
356+
acquire() call and incremented by each release() call. The counter
357+
can never go below zero; when acquire() finds that it is zero, it
358+
blocks, waiting until some other thread calls release().
359359
360360
Semaphores also support the context management protocol.
361361
@@ -511,8 +511,8 @@ async def __aexit__(self, *args):
511511
async def wait(self):
512512
"""Wait for the barrier.
513513
514-
When the specified number of tasks have started waiting, they are all
515-
simultaneously awoken.
514+
When the specified number of tasks have started waiting, they are
515+
all simultaneously awoken.
516516
Returns an unique and individual index number from 0 to 'parties-1'.
517517
"""
518518
async with self._cond:

Lib/asyncio/queues.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class QueueShutDown(Exception):
3333
class Queue(mixins._LoopBoundMixin):
3434
"""A queue, useful for coordinating producer and consumer coroutines.
3535
36-
If maxsize is less than or equal to zero, the queue size is infinite. If it
37-
is an integer greater than 0, then "await put()" will block when the
38-
queue reaches maxsize, until an item is removed by get().
36+
If maxsize is less than or equal to zero, the queue size is infinite.
37+
If it is an integer greater than 0, then "await put()" will block when
38+
the queue reaches maxsize, until an item is removed by get().
3939
4040
Unlike queue.Queue, you can reliably know this Queue's size
4141
with qsize(), since your single-threaded asyncio application won't be
@@ -174,8 +174,8 @@ async def get(self):
174174
175175
If queue is empty, wait until an item is available.
176176
177-
Raises QueueShutDown if the queue has been shut down and is empty, or
178-
if the queue has been shut down immediately.
177+
Raises QueueShutDown if the queue has been shut down and is empty,
178+
or if the queue has been shut down immediately.
179179
"""
180180
while self.empty():
181181
if self._is_shutdown and self.empty():
@@ -203,10 +203,11 @@ async def get(self):
203203
def get_nowait(self):
204204
"""Remove and return an item from the queue.
205205
206-
Return an item if one is immediately available, else raise QueueEmpty.
206+
Return an item if one is immediately available, else raise
207+
QueueEmpty.
207208
208-
Raises QueueShutDown if the queue has been shut down and is empty, or
209-
if the queue has been shut down immediately.
209+
Raises QueueShutDown if the queue has been shut down and is empty,
210+
or if the queue has been shut down immediately.
210211
"""
211212
if self.empty():
212213
if self._is_shutdown:
@@ -223,12 +224,12 @@ def task_done(self):
223224
a subsequent call to task_done() tells the queue that the processing
224225
on the task is complete.
225226
226-
If a join() is currently blocking, it will resume when all items have
227-
been processed (meaning that a task_done() call was received for every
228-
item that had been put() into the queue).
227+
If a join() is currently blocking, it will resume when all items
228+
have been processed (meaning that a task_done() call was received
229+
for every item that had been put() into the queue).
229230
230-
Raises ValueError if called more times than there were items placed in
231-
the queue.
231+
Raises ValueError if called more times than there were items placed
232+
in the queue.
232233
"""
233234
if self._unfinished_tasks <= 0:
234235
raise ValueError('task_done() called too many times')
@@ -239,10 +240,11 @@ def task_done(self):
239240
async def join(self):
240241
"""Block until all items in the queue have been gotten and processed.
241242
242-
The count of unfinished tasks goes up whenever an item is added to the
243-
queue. The count goes down whenever a consumer calls task_done() to
244-
indicate that the item was retrieved and all work on it is complete.
245-
When the count of unfinished tasks drops to zero, join() unblocks.
243+
The count of unfinished tasks goes up whenever an item is added to
244+
the queue. The count goes down whenever a consumer calls
245+
task_done() to indicate that the item was retrieved and all work on
246+
it is complete. When the count of unfinished tasks drops to zero,
247+
join() unblocks.
246248
"""
247249
if self._unfinished_tasks > 0:
248250
await self._finished.wait()

0 commit comments

Comments
 (0)