Skip to content

Commit 4b32523

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.5+ stable branch (2026-06-04)
Summary: Imported python/cpython `3.14.5+` from upstream rev [`a82a4d4`](https://www.github.com/python/cpython/commit/a82a4d4559ea82e5dd411f989839e59a5a1d357b) (committed 2026-06-04 20:44:59+00:00). # Commit Info - Base: (`3.14.5+`) - [`045bc6b`](https://www.github.com/python/cpython/commit/045bc6bcbf16a229500ce029a333314654916866) (commit date: 2026-06-04 00:21:15+00:00) - Imported: (`3.14.5+`) - [`a82a4d4`](https://www.github.com/python/cpython/commit/a82a4d4559ea82e5dd411f989839e59a5a1d357b) (commit date: 2026-06-04 20:44:59+00:00) # Noteworthy file changes - Low-signal files (2 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GOmQ-ymJf4M0L7MEALHa-cPBTO9Wbr0LAAAz Reviewed By: itamaro Differential Revision: D107645322 fbshipit-source-id: ea95b96c6dae380f3fb96e2e218a4b101251a394
1 parent e145633 commit 4b32523

14 files changed

Lines changed: 139 additions & 41 deletions

File tree

Doc/data/stable_abi.dat

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/library/gettext.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ class-based API instead.
5454

5555

5656
.. index:: single: _ (underscore); gettext
57-
.. function:: gettext(message)
57+
.. function:: gettext(message, /)
5858

5959
Return the localized translation of *message*, based on the current global
6060
domain, language, and locale directory. This function is usually aliased as
6161
:func:`!_` in the local namespace (see examples below).
6262

6363

64-
.. function:: dgettext(domain, message)
64+
.. function:: dgettext(domain, message, /)
6565

6666
Like :func:`.gettext`, but look the message up in the specified *domain*.
6767

6868

69-
.. function:: ngettext(singular, plural, n)
69+
.. function:: ngettext(singular, plural, n, /)
7070

7171
Like :func:`.gettext`, but consider plural forms. If a translation is found,
7272
apply the plural formula to *n*, and return the resulting message (some
@@ -81,15 +81,15 @@ class-based API instead.
8181
formulas for a variety of languages.
8282

8383

84-
.. function:: dngettext(domain, singular, plural, n)
84+
.. function:: dngettext(domain, singular, plural, n, /)
8585

8686
Like :func:`ngettext`, but look the message up in the specified *domain*.
8787

8888

89-
.. function:: pgettext(context, message)
90-
.. function:: dpgettext(domain, context, message)
91-
.. function:: npgettext(context, singular, plural, n)
92-
.. function:: dnpgettext(domain, context, singular, plural, n)
89+
.. function:: pgettext(context, message, /)
90+
.. function:: dpgettext(domain, context, message, /)
91+
.. function:: npgettext(context, singular, plural, n, /)
92+
.. function:: dnpgettext(domain, context, singular, plural, n, /)
9393

9494
Similar to the corresponding functions without the ``p`` in the prefix (that
9595
is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`),
@@ -226,28 +226,28 @@ are the methods of :class:`!NullTranslations`:
226226
translation for a given message.
227227

228228

229-
.. method:: gettext(message)
229+
.. method:: gettext(message, /)
230230

231231
If a fallback has been set, forward :meth:`!gettext` to the fallback.
232232
Otherwise, return *message*. Overridden in derived classes.
233233

234234

235-
.. method:: ngettext(singular, plural, n)
235+
.. method:: ngettext(singular, plural, n, /)
236236

237237
If a fallback has been set, forward :meth:`!ngettext` to the fallback.
238238
Otherwise, return *singular* if *n* is 1; return *plural* otherwise.
239239
Overridden in derived classes.
240240

241241

242-
.. method:: pgettext(context, message)
242+
.. method:: pgettext(context, message, /)
243243

244244
If a fallback has been set, forward :meth:`pgettext` to the fallback.
245245
Otherwise, return the translated message. Overridden in derived classes.
246246

247247
.. versionadded:: 3.8
248248

249249

250-
.. method:: npgettext(context, singular, plural, n)
250+
.. method:: npgettext(context, singular, plural, n, /)
251251

252252
If a fallback has been set, forward :meth:`npgettext` to the fallback.
253253
Otherwise, return the translated message. Overridden in derived classes.
@@ -325,7 +325,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
325325

326326
The following methods are overridden from the base class implementation:
327327

328-
.. method:: gettext(message)
328+
.. method:: gettext(message, /)
329329

330330
Look up the *message* id in the catalog and return the corresponding message
331331
string, as a Unicode string. If there is no entry in the catalog for the
@@ -334,7 +334,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
334334
*message* id is returned.
335335

336336

337-
.. method:: ngettext(singular, plural, n)
337+
.. method:: ngettext(singular, plural, n, /)
338338

339339
Do a plural-forms lookup of a message id. *singular* is used as the message id
340340
for purposes of lookup in the catalog, while *n* is used to determine which
@@ -355,7 +355,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
355355
n) % {'num': n}
356356

357357

358-
.. method:: pgettext(context, message)
358+
.. method:: pgettext(context, message, /)
359359

360360
Look up the *context* and *message* id in the catalog and return the
361361
corresponding message string, as a Unicode string. If there is no
@@ -366,7 +366,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
366366
.. versionadded:: 3.8
367367

368368

369-
.. method:: npgettext(context, singular, plural, n)
369+
.. method:: npgettext(context, singular, plural, n, /)
370370

371371
Do a plural-forms lookup of a message id. *singular* is used as the
372372
message id for purposes of lookup in the catalog, while *n* is used to

Doc/library/stdtypes.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,9 @@ expression support in the :mod:`re` module).
26122612
:func:`re.split`). Splitting an empty string with a specified separator
26132613
returns ``['']``.
26142614

2615-
For example::
2615+
For example:
2616+
2617+
.. doctest::
26162618

26172619
>>> '1,2,3'.split(',')
26182620
['1', '2', '3']
@@ -2630,7 +2632,9 @@ expression support in the :mod:`re` module).
26302632
string or a string consisting of just whitespace with a ``None`` separator
26312633
returns ``[]``.
26322634

2633-
For example::
2635+
For example:
2636+
2637+
.. doctest::
26342638

26352639
>>> '1 2 3'.split()
26362640
['1', '2', '3']
@@ -2642,7 +2646,9 @@ expression support in the :mod:`re` module).
26422646
If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only
26432647
leading runs of consecutive whitespace are considered.
26442648

2645-
For example::
2649+
For example:
2650+
2651+
.. doctest::
26462652

26472653
>>> "".split(None, 0)
26482654
[]
@@ -2651,7 +2657,7 @@ expression support in the :mod:`re` module).
26512657
>>> " foo ".split(maxsplit=0)
26522658
['foo ']
26532659

2654-
See also :meth:`join`.
2660+
See also :meth:`join` and :meth:`rsplit`.
26552661

26562662

26572663
.. index::

Doc/using/windows.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,12 @@ customization.
457457
Python runtimes, or false to prevent it.
458458
By default, true.
459459

460+
* - ``shebang_templates``
461+
- (none)
462+
- Mapping from shebang line template to alternative command, such as
463+
``py -V:<tag>`` or a substitute string.
464+
See :ref:`pymanager-shebang` for more details.
465+
460466
* - ``log_level``
461467
- ``PYMANAGER_VERBOSE``, ``PYMANAGER_DEBUG``
462468
- Set the default level of output (0-50).
@@ -570,6 +576,30 @@ which the path to the script and any additional arguments will be appended.
570576
This functionality may be disabled by the ``shebang_can_run_anything``
571577
configuration option.
572578

579+
Since version 26.3 of the Python install manager, custom shebang templates may
580+
be added to your configuration file. Add the ``shebang_templates`` object with
581+
one member for each template (the string to match) and the command to use when
582+
the template is matched. Most commands should be ``py -V:<tag>`` (or ``pyw``) to
583+
launch one of your installed runtimes. The ``py -3.<version>`` form is also
584+
allowed, as is a plain ``py`` to launch the default. No other arguments are
585+
supported.
586+
587+
.. code:: json5
588+
589+
{
590+
"shebang_templates": {
591+
"/usr/bin/python": "py",
592+
"/usr/bin/my_custom_python": "py -V:MyCustomPython/3"
593+
}
594+
}
595+
596+
If the substitute command is not ``py`` or ``pyw``, it will be written back into
597+
the shebang and regular handling continues. If launching arbitrary executables
598+
is permitted, then providing a full path will allow you to redirect from Python
599+
to any executable. The template should match either the entire line (ignoring
600+
leading and trailing whitespace), or up to the first space in the shebang line.
601+
602+
573603
.. note::
574604

575605
The behaviour of shebangs in the Python install manager is subtly different

Lib/test/test_deque.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,22 @@ def test_index(self):
287287
else:
288288
self.assertEqual(d.index(element, start, stop), target)
289289

290+
# Test stop argument
291+
for elem in d:
292+
index = d.index(elem)
293+
self.assertEqual(
294+
index,
295+
d.index(elem, 0),
296+
)
297+
self.assertEqual(
298+
index,
299+
d.index(elem, 0, len(d)),
300+
)
301+
self.assertEqual(
302+
index,
303+
d.index(elem, 0, len(d) + 100),
304+
)
305+
290306
# Test large start argument
291307
d = deque(range(0, 10000, 10))
292308
for step in range(100):

Lib/test/test_free_threading/test_collections.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,30 @@ def copy_loop():
2424

2525
threading_helper.run_concurrently([mutate, copy_loop])
2626

27+
def test_index_race_in_ac(self):
28+
# gh-150750: There was a c_default specified as `Py_SIZE(self)`,
29+
# it was used without a critical section.
30+
31+
d = deque(range(100))
32+
33+
def index():
34+
for _ in range(10000):
35+
try:
36+
d.index(50)
37+
except ValueError:
38+
pass
39+
40+
def mutate():
41+
for _ in range(10000):
42+
d.append(0)
43+
d.clear()
44+
d.extend(range(100))
45+
d.appendleft(-1)
46+
47+
threading_helper.run_concurrently(
48+
[index, *[mutate for _ in range(3)]],
49+
)
50+
2751

2852
if __name__ == "__main__":
2953
unittest.main()

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,18 @@ def test_blob_set_empty_slice(self):
14081408
self.blob[0:0] = b""
14091409
self.assertEqual(self.blob[:], self.data)
14101410

1411+
def test_blob_set_empty_slice_wrong_type(self):
1412+
with self.assertRaises(TypeError):
1413+
self.blob[5:5] = None
1414+
1415+
def test_blob_set_empty_slice_wrong_size(self):
1416+
with self.assertRaisesRegex(IndexError, "wrong size"):
1417+
self.blob[5:5] = b"123"
1418+
1419+
def test_blob_set_empty_slice_correct(self):
1420+
self.blob[5:5] = b""
1421+
self.assertEqual(self.blob[:], self.data)
1422+
14111423
def test_blob_set_slice_with_skip(self):
14121424
self.blob[0:10:2] = b"12345"
14131425
actual = self.cx.execute("select b from test").fetchone()[0]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a race condition in :meth:`collections.deque.index` with free-threading.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix :class:`sqlite3.Blob` slice assignment to raise
2+
:exc:`TypeError` and :exc:`IndexError` for type and size mismatches
3+
respectively, even when the target slice is empty.

Misc/stable_abi.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,6 @@
17871787
[const.METH_COEXIST]
17881788
added = '3.2'
17891789
# METH_STACKLESS is undocumented
1790-
# METH_FASTCALL is not part of limited API.
17911790

17921791
# The following are defined in private headers, but historically
17931792
# they were exported as part of the stable ABI.
@@ -2121,8 +2120,6 @@
21212120

21222121
# New method flags in 3.7 (PEP 590):
21232122

2124-
[const.METH_FASTCALL]
2125-
added = '3.7'
21262123
[const.METH_METHOD]
21272124
added = '3.7'
21282125

@@ -2272,6 +2269,10 @@
22722269
[data.PyStructSequence_UnnamedField]
22732270
added = '3.11'
22742271

2272+
# Added in 3.7 but in the Stable ABI from 3.10
2273+
[const.METH_FASTCALL]
2274+
added = '3.10'
2275+
22752276
# Add stable Py_buffer API in Python 3.11 (https://bugs.python.org/issue45459)
22762277
[struct.Py_buffer]
22772278
added = '3.11'

0 commit comments

Comments
 (0)