Skip to content

Commit ac0e48e

Browse files
itamarometa-codesync[bot]
authored andcommitted
Import CPython 3.15.0+dev stable branch (2026-10-10)
Summary: Imported python/cpython `3.15.0+dev` from upstream rev [`d59ff39`](https://www.github.com/python/cpython/commit/d59ff393d718cd0ba209b23004178c21ce85a0a0) (committed 2026-10-10 21:32:17+00:00). # Commit Info - Base: (`3.15.0+dev`) - [`b57aea1`](https://www.github.com/python/cpython/commit/b57aea1261e419361c82d3fde02bc919be5e979f) (commit date: 2026-10-09 13:58:09+00:00) - Imported: (`3.15.0+dev`) - [`d59ff39`](https://www.github.com/python/cpython/commit/d59ff393d718cd0ba209b23004178c21ce85a0a0) (commit date: 2026-10-10 21:32:17+00:00) # Noteworthy file changes - Native files (2 added): ``` + Modules/_testlimitedcapi/slice.c + Modules/_testlimitedcapi/type.c ``` - Test files (5 added, 1 removed) - Low-signal files (124 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GNUTMjKwSXewS2cGALFEg3JXMQ4Hbr0LAAAz Reviewed By: alexmalyshev Differential Revision: D124612611 fbshipit-source-id: adcdbbadcfbcd566974d1949ea06dcae1024fa3a
1 parent 4c0693b commit ac0e48e

467 files changed

Lines changed: 8763 additions & 1650 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/CODEOWNERS‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,12 @@ Lib/test/test_unittest/testmock/ @cjw296
624624
# Weakref
625625
**/*weakref* @kumaraditya303
626626

627+
# Zlib
628+
Doc/library/zlib.rst @StanFromIreland
629+
Lib/compression/zlib.py @StanFromIreland
630+
Lib/test/test_zlib.py @StanFromIreland
631+
Modules/_zlibmodule.c @StanFromIreland
632+
627633
# Zipfile.Path
628634
Lib/test/test_zipfile/_path/ @jaraco
629635
Lib/zipfile/_path/ @jaraco

‎.github/workflows/mypy.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
7070
with:
7171
persist-credentials: false
72-
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
72+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
7373
with:
7474
python-version: "3.15"
7575
activate-environment: true

‎.github/workflows/reusable-cifuzz.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
path: ./out/artifacts
4444
- name: Upload SARIF
4545
if: always() && steps.build.outcome == 'success'
46-
uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
46+
uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
4747
with:
4848
sarif_file: cifuzz-sarif/results.sarif
4949
checkout_path: cifuzz-sarif

‎Doc/builtins/functions.rst‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,14 @@ are always available. They are listed here in alphabetical order.
344344
It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings
345345
by module name.
346346

347-
This function raises :exc:`SyntaxError` or :exc:`ValueError` if the compiled
348-
source is invalid.
347+
This function raises :exc:`SyntaxError` if the compiled source is invalid,
348+
including a *source* containing a null character or that cannot be decoded;
349+
:exc:`ValueError` if *mode* or *flags* is invalid,
350+
or if a string *source* contains surrogate characters;
351+
:exc:`MemoryError` or :exc:`RecursionError` if *source* is too complex
352+
to parse or compile,
353+
for example an expression with many thousands of nested operators;
354+
and :exc:`OverflowError` if *source* is too large.
349355

350356
If you want to parse Python code into its AST representation, see
351357
:func:`ast.parse`.
@@ -377,11 +383,15 @@ are always available. They are listed here in alphabetical order.
377383
Previously, :exc:`TypeError` was raised when null bytes were encountered
378384
in *source*.
379385

380-
.. versionadded:: 3.8
386+
.. versionchanged:: 3.8
381387
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
382388
support for top-level ``await``, ``async for``, and ``async with``.
383389

384-
.. versionadded:: 3.15
390+
.. versionchanged:: 3.12
391+
:exc:`SyntaxError` is raised instead of :exc:`ValueError` when null bytes
392+
are encountered in *source*.
393+
394+
.. versionchanged:: 3.15
385395
Added the *module* parameter.
386396

387397

‎Doc/c-api/bytes.rst‎

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,3 +458,112 @@ Low-level API
458458
return NULL;
459459
}
460460
return (char*)PyBytesWriter_GetData(writer) + pos;
461+
462+
463+
Example creating the string ``b'abc'``
464+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
465+
466+
Example creating the bytes string ``b"abc"``, with a fixed size of 3 bytes::
467+
468+
PyObject* create_abc(void)
469+
{
470+
PyBytesWriter *writer = PyBytesWriter_Create(3);
471+
if (writer == NULL) {
472+
return NULL;
473+
}
474+
475+
char *str = PyBytesWriter_GetData(writer);
476+
memcpy(str, "abc", 3);
477+
return PyBytesWriter_Finish(writer);
478+
}
479+
480+
Variant using a pointer to compute the final size::
481+
482+
PyObject* create_abc_ptr(void)
483+
{
484+
PyBytesWriter *writer = PyBytesWriter_Create(3);
485+
if (writer == NULL) {
486+
return NULL;
487+
}
488+
489+
char *str = PyBytesWriter_GetData(writer);
490+
memcpy(str, "abc", 3);
491+
str += 1;
492+
return PyBytesWriter_FinishWithPointer(writer, str);
493+
}
494+
495+
496+
Update ``PyBytes_FromStringAndSize()`` code
497+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
498+
499+
Example of code using the soft deprecated
500+
``PyBytes_FromStringAndSize(NULL, size)`` API::
501+
502+
int copy_bytes(char *dest, const char *src, Py_ssize_t num_bytes)
503+
{
504+
...
505+
}
506+
507+
PyObject* create_string(const char *start, Py_ssize_t num_bytes)
508+
{
509+
PyObject *result = PyBytes_FromStringAndSize(NULL, num_bytes);
510+
if (result == NULL) {
511+
return NULL;
512+
}
513+
if (copy_bytes(PyBytes_AS_STRING(result), start, num_bytes) < 0) {
514+
Py_CLEAR(result);
515+
}
516+
return result;
517+
}
518+
519+
It can now be updated to::
520+
521+
PyObject* create_string(const char *start, Py_ssize_t num_bytes)
522+
{
523+
PyBytesWriter *writer = PyBytesWriter_Create(num_bytes);
524+
if (writer == NULL) {
525+
return NULL;
526+
}
527+
if (copy_bytes(PyBytesWriter_GetData(writer), start, num_bytes) < 0) {
528+
PyBytesWriter_Discard(writer);
529+
return NULL;
530+
}
531+
return PyBytesWriter_Finish(writer);
532+
}
533+
534+
535+
Update ``_PyBytes_Resize()`` code
536+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
537+
538+
Example of code using the soft deprecated ``_PyBytes_Resize()`` API::
539+
540+
void create_string(Py_ssize_t size)
541+
{
542+
PyObject *bytes = PyBytes_FromStringAndSize(NULL, size);
543+
if (bytes == NULL) {
544+
return NULL;
545+
}
546+
char *str = PyBytes_AS_STRING(bytes);
547+
548+
// ... write data into str ...
549+
550+
if (_PyBytes_Resize(&bytes, (str - PyBytes_AS_STRING(bytes)))) {
551+
return NULL;
552+
}
553+
return bytes;
554+
}
555+
556+
It can now be updated to::
557+
558+
void create_string(Py_ssize_t size)
559+
{
560+
PyBytesWriter *writer = PyBytesWriter_Create(size);
561+
if (writer == NULL) {
562+
return NULL;
563+
}
564+
char *str = PyBytesWriter_GetData(writer);
565+
566+
// ... write data into str ...
567+
568+
return PyBytesWriter_FinishWithPointer(writer, str);
569+
}

‎Doc/c-api/slice.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Slice Objects
5353
length *length*, and store the length of the slice in *slicelength*. Out
5454
of bounds indices are clipped in a manner consistent with the handling of
5555
normal slices.
56+
*length* must not be negative.
5657
5758
Return ``0`` on success and ``-1`` on error with an exception set.
5859
@@ -108,6 +109,10 @@ Slice Objects
108109
Out of bounds indices are clipped in a manner consistent with the handling
109110
of normal slices.
110111
112+
*length* must not be negative.
113+
*step* must not be zero and must not be less than ``-PY_SSIZE_T_MAX``,
114+
as guaranteed by :c:func:`PySlice_Unpack`.
115+
111116
Return the length of the slice. Always successful. Doesn't call Python
112117
code.
113118

‎Doc/library/code.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Interactive Interpreter Objects
9292
*symbol* is ``'single'``. One of several things can happen:
9393

9494
* The input is incorrect; :func:`compile_command` raised an exception
95-
(:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be
95+
(usually :exc:`SyntaxError`). A syntax traceback will be
9696
printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource`
9797
returns ``False``.
9898

‎Doc/library/ctypes.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,10 @@ These prefabricated library loaders are available:
17131713
:c:expr:`int`, which is of course not always the truth, so you have to assign
17141714
the correct :attr:`!restype` attribute to use these functions.
17151715

1716+
.. note::
1717+
1718+
If the Python interpreter is statically linked, this may be ``None``.
1719+
17161720
.. audit-event:: ctypes.dlopen name ctypes.LibraryLoader
17171721

17181722
Loading a library through any of these objects raises an

‎Doc/library/imaplib.rst‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,20 @@ An :class:`IMAP4` instance has the following methods:
698698

699699
The following attributes are defined on instances of :class:`IMAP4`:
700700

701+
.. attribute:: IMAP4.capabilities
702+
703+
A tuple of the capabilities advertised by the server, in upper case.
704+
705+
It is set when the connection is established,
706+
and refreshed after a successful :meth:`~IMAP4.login`,
707+
:meth:`~IMAP4.authenticate` or :meth:`~IMAP4.starttls`,
708+
because the server can advertise different capabilities
709+
in different connection states.
710+
711+
.. versionchanged:: 3.14.7
712+
Refreshed after :meth:`~IMAP4.login` and :meth:`~IMAP4.authenticate`.
713+
714+
701715
.. attribute:: IMAP4.PROTOCOL_VERSION
702716

703717
The most recent supported protocol in the ``CAPABILITY`` response from the

‎Doc/library/inspect.rst‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
485485
Functions wrapped in :func:`functools.partial` now return ``True`` if the
486486
wrapped function is a Python generator function.
487487

488+
.. versionchanged:: 3.10.6
489+
:term:`Duck-typed <duck-typing>` function-like objects now return
490+
``True`` if their code object has the :data:`CO_GENERATOR` flag.
491+
488492
.. versionchanged:: 3.13
489493
Functions wrapped in :func:`functools.partialmethod` now return ``True``
490494
if the wrapped function is a Python generator function.
@@ -507,6 +511,10 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
507511
Functions wrapped in :func:`functools.partial` now return ``True`` if the
508512
wrapped function is a :term:`coroutine function`.
509513

514+
.. versionchanged:: 3.10.6
515+
:term:`Duck-typed <duck-typing>` function-like objects now return
516+
``True`` if their code object has the :data:`CO_COROUTINE` flag.
517+
510518
.. versionchanged:: 3.12
511519
Sync functions marked with :func:`markcoroutinefunction` now return
512520
``True``.
@@ -581,6 +589,10 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
581589
Functions wrapped in :func:`functools.partial` now return ``True`` if the
582590
wrapped function is an :term:`asynchronous generator` function.
583591

592+
.. versionchanged:: 3.10.6
593+
:term:`Duck-typed <duck-typing>` function-like objects now return
594+
``True`` if their code object has the :data:`CO_ASYNC_GENERATOR` flag.
595+
584596
.. versionchanged:: 3.13
585597
Functions wrapped in :func:`functools.partialmethod` now return ``True``
586598
if the wrapped function is a :term:`asynchronous generator` function.

0 commit comments

Comments
 (0)