Skip to content

Commit c8c2760

Browse files
itamarometa-codesync[bot]
authored andcommitted
Import CPython 3.15.0+dev stable branch (2026-10-17)
Summary: Imported python/cpython `3.15.0+dev` from upstream rev [`cfaf180`](https://www.github.com/python/cpython/commit/cfaf180449e937770e6b3400630d0febb7565208) (committed 2026-10-17 23:37:58+00:00). # Commit Info - Base: (`3.15.0+dev`) - [`b65c01c`](https://www.github.com/python/cpython/commit/b65c01c2014dc3a483afd9fddbc53a4ed14a5038) (commit date: 2026-10-15 13:02:19+00:00) - Imported: (`3.15.0+dev`) - [`cfaf180`](https://www.github.com/python/cpython/commit/cfaf180449e937770e6b3400630d0febb7565208) (commit date: 2026-10-17 23:37:58+00:00) # Noteworthy file changes - Native files (1 added): ``` + Modules/_testlimitedcapi/build.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=GGr2fTKlHpD_rcQFAFAkkv-MP7cbbr0LAAAz Reviewed By: yoney Differential Revision: D125919261 fbshipit-source-id: 580b4a4ddc69a37829babc3ff3b846304b4b19e6
1 parent 5d0cab3 commit c8c2760

72 files changed

Lines changed: 2556 additions & 748 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.

‎Doc/c-api/bytes.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ object.
299299
300300
A bytes writer instance.
301301
302-
The API is **not thread safe**: a writer should only be used by a single
303-
thread at the same time.
302+
The API is **not thread safe**. To share a writer with multiple threads, a
303+
critical section or a lock is needed.
304304
305305
The instance must be destroyed by :c:func:`PyBytesWriter_Finish` on
306306
success, or :c:func:`PyBytesWriter_Discard` on error.
@@ -436,7 +436,7 @@ Low-level API
436436
On success, return ``0``.
437437
On error, set an exception and return ``-1``.
438438
439-
*size* can be negative to shrink the writer.
439+
*grow* can be negative to shrink the writer.
440440
441441
.. c:function:: void* PyBytesWriter_GrowAndUpdatePointer(PyBytesWriter *writer, Py_ssize_t size, void *buf)
442442

‎Doc/c-api/unicode.rst‎

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ points must be below 1114112 (which is the full Unicode range).
1616

1717
UTF-8 representation is created on demand and cached in the Unicode object.
1818

19+
.. impl-detail::
20+
21+
The internal buffer always includes an extra trailing null character for
22+
compatibility with null terminated C strings. This extra character is not
23+
counted in :c:func:`PyUnicode_GetLength` nor in the various *size* arguments
24+
of the functions below.
25+
1926
.. note::
2027
The :c:type:`Py_UNICODE` representation has been removed since Python 3.12
2128
with deprecated APIs.
@@ -164,11 +171,15 @@ access to internal read-only data of Unicode objects:
164171
.. versionadded:: 3.3
165172
166173
167-
.. c:function:: Py_UCS4 PyUnicode_READ(int kind, void *data, \
168-
Py_ssize_t index)
174+
.. c:function:: Py_UCS4 PyUnicode_READ(int kind, void *data, Py_ssize_t index)
169175
170176
Read a code point from a canonical representation *data* (as obtained with
171-
:c:func:`PyUnicode_DATA`). No checks or ready calls are performed.
177+
:c:func:`PyUnicode_DATA`). No checks are performed.
178+
179+
.. impl-detail::
180+
181+
Accept reading the trailing null character at index
182+
:c:func:`PyUnicode_GetLength`.
172183
173184
.. versionadded:: 3.3
174185
@@ -179,6 +190,11 @@ access to internal read-only data of Unicode objects:
179190
representation. This is less efficient than :c:func:`PyUnicode_READ` if you
180191
do multiple consecutive reads.
181192
193+
.. impl-detail::
194+
195+
Accept reading the trailing null character at index
196+
:c:func:`PyUnicode_GetLength`.
197+
182198
.. versionadded:: 3.3
183199
184200
@@ -409,6 +425,10 @@ APIs:
409425
the UCS1 range, it will be transformed into UCS1
410426
(:c:macro:`PyUnicode_1BYTE_KIND`).
411427
428+
All characters must be in range [U+0000; U+10ffff]. If *kind* is
429+
:c:macro:`PyUnicode_4BYTE_KIND` and the string contains invalid characters,
430+
the behavior is undefined.
431+
412432
.. versionadded:: 3.3
413433
414434
@@ -716,6 +736,10 @@ APIs:
716736
717737
On error, set an exception and return ``-1``.
718738
739+
.. impl-detail::
740+
741+
The length does not count the trailing null character.
742+
719743
.. versionadded:: 3.3
720744
721745
@@ -794,6 +818,11 @@ APIs:
794818
795819
Return character on success, ``-1`` on error with an exception set.
796820
821+
.. impl-detail::
822+
823+
Do not accept reading the trailing null character at index
824+
:c:func:`PyUnicode_GetLength`.
825+
797826
.. versionadded:: 3.3
798827
799828
@@ -1797,6 +1826,9 @@ object.
17971826
The instance must be destroyed by :c:func:`PyUnicodeWriter_Finish` on
17981827
success, or :c:func:`PyUnicodeWriter_Discard` on error.
17991828
1829+
The API is **not thread safe**. To share a writer with multiple threads, a
1830+
critical section or a lock is needed.
1831+
18001832
.. c:function:: PyUnicodeWriter* PyUnicodeWriter_Create(Py_ssize_t length)
18011833
18021834
Create a Unicode writer instance.
@@ -1868,10 +1900,13 @@ object.
18681900
18691901
.. c:function:: int PyUnicodeWriter_WriteUCS4(PyUnicodeWriter *writer, const Py_UCS4 *str, Py_ssize_t size)
18701902
1871-
Writer the UCS4 string *str* into *writer*.
1903+
Write the UCS4 string *str* into *writer*.
18721904
18731905
*size* is a number of UCS4 characters.
18741906
1907+
All characters must be in range [U+0000; U+10ffff]. If the string contains
1908+
invalid characters, the behavior is undefined.
1909+
18751910
On success, return ``0``.
18761911
On error, set an exception, leave the writer unchanged, and return ``-1``.
18771912

‎Doc/library/calendar.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
169169
the specified width, representing an empty day. The *weekday* parameter
170170
is unused.
171171

172-
.. method:: formatweek(theweek, w=0)
172+
.. method:: formatweek(theweek, width)
173173

174-
Return a single week in a string with no newline. If *w* is provided, it
175-
specifies the width of the date columns, which are centered. Depends
174+
Return a single week in a string with no newline. *width* specifies
175+
the width of the date columns, which are centered. Depends
176176
on the first weekday as specified in the constructor or set by the
177177
:meth:`setfirstweekday` method.
178178

@@ -200,7 +200,7 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
200200
:meth:`setfirstweekday` method.
201201

202202

203-
.. method:: formatmonthname(theyear, themonth, width=0, withyear=True)
203+
.. method:: formatmonthname(theyear, themonth, width, withyear=True)
204204

205205
Return a string representing the month's name centered within the
206206
specified *width*. If *withyear* is ``True``, include the year in the

‎Doc/library/test.rst‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,13 @@ test suite, thanks to the :option:`-m` option: :program:`python -m test`. Under
165165
the hood, it uses :mod:`!test.regrtest`; the call :program:`python -m
166166
test.regrtest` used in previous Python versions still works. Running the
167167
script by itself automatically starts running all regression tests in the
168-
:mod:`!test` package. It does this by finding all modules in the package whose
169-
name starts with ``test_``, importing them, and executing the function
170-
:func:`test_main` if present or loading the tests via
171-
unittest.TestLoader.loadTestsFromModule if ``test_main`` does not exist. The
172-
names of tests to execute may also be passed to the script. Specifying a single
168+
:mod:`!test` package. It does this by finding modules and packages whose names
169+
start with ``test_``, importing each one, and loading its tests with
170+
:meth:`unittest.TestLoader.loadTestsFromModule`. See the
171+
:ref:`load_tests protocol <load_tests-protocol>` for how a module or package
172+
can customize what is loaded. Defining a module-level ``test_main()`` function
173+
is not supported and causes the test to fail. The names of tests to
174+
execute may also be passed to the script. Specifying a single
173175
regression test (:program:`python -m test test_spam`) will minimize output and
174176
only print whether the test passed or failed.
175177

@@ -881,9 +883,11 @@ The :mod:`!test.support` module defines the following functions:
881883

882884
.. function:: reap_children()
883885

884-
Use this at the end of ``test_main`` whenever sub-processes are started.
885-
This will help ensure that no extra children (zombies) stick around to
886-
hog resources and create problems when looking for refleaks.
886+
Call this from :meth:`~unittest.TestCase.setUp`,
887+
:meth:`~unittest.TestCase.tearDown`, or ``tearDownModule()`` in tests
888+
that start subprocesses. This will help ensure that no extra children
889+
(zombies) stick around to hog resources and create problems when looking
890+
for refleaks.
887891

888892

889893
.. function:: get_attribute(obj, name)

0 commit comments

Comments
 (0)