Skip to content

Commit 75230b0

Browse files
committed
Merge branch 'main' of github.com:python/cpython into gh-102251
2 parents 20307d0 + f332594 commit 75230b0

File tree

108 files changed

+3398
-2323
lines changed

Some content is hidden

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

108 files changed

+3398
-2323
lines changed

.github/workflows/build.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,20 @@ jobs:
8787
with:
8888
filter: |
8989
Doc/**
90-
Misc/**
90+
# Temporarily skip paths with spaces
91+
# (i.e. "C API", "Core and Builtins")
92+
# to avoid "Error: One of your files includes a space".
93+
# Pending https://github.com/python/core-workflow/issues/186
94+
# Misc/**
95+
Misc/NEWS.d/next/Build/**
96+
Misc/NEWS.d/next/Documentation/**
97+
Misc/NEWS.d/next/IDLE/**
98+
Misc/NEWS.d/next/Library/**
99+
Misc/NEWS.d/next/Security/**
100+
Misc/NEWS.d/next/Tests/**
101+
Misc/NEWS.d/next/Tools-Demos/**
102+
Misc/NEWS.d/next/Windows/**
103+
Misc/NEWS.d/next/macOS/**
91104
.github/workflows/reusable-docs.yml
92105
- name: Check for docs changes
93106
if: >-

Doc/c-api/arg.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,18 @@ unit; the entry in (round) parentheses is the Python object type that matches
2727
the format unit; and the entry in [square] brackets is the type of the C
2828
variable(s) whose address should be passed.
2929

30+
.. _arg-parsing-string-and-buffers:
31+
3032
Strings and buffers
3133
-------------------
3234

35+
.. note::
36+
37+
On Python 3.12 and older, the macro :c:macro:`!PY_SSIZE_T_CLEAN` must be
38+
defined before including :file:`Python.h` to use all ``#`` variants of
39+
formats (``s#``, ``y#``, etc.) explained below.
40+
This is not necessary on Python 3.13 and later.
41+
3342
These formats allow accessing an object as a contiguous chunk of memory.
3443
You don't have to provide raw storage for the returned unicode or bytes
3544
area.
@@ -68,15 +77,6 @@ There are three ways strings and buffers can be converted to C:
6877
whether the input object is immutable (e.g. whether it would honor a request
6978
for a writable buffer, or whether another thread can mutate the data).
7079

71-
.. note::
72-
73-
For all ``#`` variants of formats (``s#``, ``y#``, etc.), the macro
74-
:c:macro:`PY_SSIZE_T_CLEAN` must be defined before including
75-
:file:`Python.h`. On Python 3.9 and older, the type of the length argument
76-
is :c:type:`Py_ssize_t` if the :c:macro:`PY_SSIZE_T_CLEAN` macro is defined,
77-
or int otherwise.
78-
79-
8080
``s`` (:class:`str`) [const char \*]
8181
Convert a Unicode object to a C pointer to a character string.
8282
A pointer to an existing string is stored in the character pointer

Doc/c-api/exceptions.rst

+12
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,18 @@ Exception Objects
772772
773773
Set :attr:`~BaseException.args` of exception *ex* to *args*.
774774
775+
.. c:function:: PyObject* PyUnstable_Exc_PrepReraiseStar(PyObject *orig, PyObject *excs)
776+
777+
Implement part of the interpreter's implementation of :keyword:`!except*`.
778+
*orig* is the original exception that was caught, and *excs* is the list of
779+
the exceptions that need to be raised. This list contains the the unhandled
780+
part of *orig*, if any, as well as the exceptions that were raised from the
781+
:keyword:`!except*` clauses (so they have a different traceback from *orig*) and
782+
those that were reraised (and have the same traceback as *orig*).
783+
Return the :exc:`ExceptionGroup` that needs to be reraised in the end, or
784+
``None`` if there is nothing to reraise.
785+
786+
.. versionadded:: 3.12
775787
776788
.. _unicodeexceptions:
777789

Doc/data/stable_abi.dat

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/extending/extending.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ the module and a copyright notice if you like).
7070
headers are included.
7171

7272
It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including
73-
``Python.h``. See :ref:`parsetuple` for a description of this macro.
73+
``Python.h``. See :ref:`arg-parsing-string-and-buffers` for a description of this macro.
7474

7575
All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or
7676
``PY``, except those defined in standard header files. For convenience, and
@@ -649,7 +649,7 @@ Note that any Python object references which are provided to the caller are
649649

650650
Some example calls::
651651

652-
#define PY_SSIZE_T_CLEAN /* Make "s#" use Py_ssize_t rather than int. */
652+
#define PY_SSIZE_T_CLEAN
653653
#include <Python.h>
654654

655655
::
@@ -745,7 +745,7 @@ it returns false and raises an appropriate exception.
745745
Here is an example module which uses keywords, based on an example by Geoff
746746
Philbrick ([email protected])::
747747

748-
#define PY_SSIZE_T_CLEAN /* Make "s#" use Py_ssize_t rather than int. */
748+
#define PY_SSIZE_T_CLEAN
749749
#include <Python.h>
750750

751751
static PyObject *

Doc/library/ast.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1744,17 +1744,17 @@ aliases.
17441744
Function and class definitions
17451745
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17461746

1747-
.. class:: FunctionDef(name, type_params, args, body, decorator_list, returns, type_comment)
1747+
.. class:: FunctionDef(name, args, body, decorator_list, returns, type_comment, type_params)
17481748

17491749
A function definition.
17501750

17511751
* ``name`` is a raw string of the function name.
1752-
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
17531752
* ``args`` is an :class:`arguments` node.
17541753
* ``body`` is the list of nodes inside the function.
17551754
* ``decorator_list`` is the list of decorators to be applied, stored outermost
17561755
first (i.e. the first in the list will be applied last).
17571756
* ``returns`` is the return annotation.
1757+
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
17581758

17591759
.. attribute:: type_comment
17601760

@@ -1917,19 +1917,19 @@ Function and class definitions
19171917
type_ignores=[])
19181918

19191919

1920-
.. class:: ClassDef(name, type_params, bases, keywords, body, decorator_list)
1920+
.. class:: ClassDef(name, bases, keywords, body, decorator_list, type_params)
19211921

19221922
A class definition.
19231923

19241924
* ``name`` is a raw string for the class name
1925-
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
19261925
* ``bases`` is a list of nodes for explicitly specified base classes.
19271926
* ``keywords`` is a list of :class:`keyword` nodes, principally for 'metaclass'.
19281927
Other keywords will be passed to the metaclass, as per `PEP-3115
19291928
<https://peps.python.org/pep-3115/>`_.
19301929
* ``body`` is a list of nodes representing the code within the class
19311930
definition.
19321931
* ``decorator_list`` is a list of nodes, as in :class:`FunctionDef`.
1932+
* ``type_params`` is a list of :ref:`type parameters <ast-type-params>`.
19331933

19341934
.. doctest::
19351935

@@ -1961,7 +1961,7 @@ Function and class definitions
19611961
Async and await
19621962
^^^^^^^^^^^^^^^
19631963

1964-
.. class:: AsyncFunctionDef(name, args, body, decorator_list, returns, type_comment)
1964+
.. class:: AsyncFunctionDef(name, args, body, decorator_list, returns, type_comment, type_params)
19651965

19661966
An ``async def`` function definition. Has the same fields as
19671967
:class:`FunctionDef`.

Doc/library/pathlib.rst

+11
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,13 @@ Pure paths provide the following methods and properties:
569569
>>> PurePath('a/b.py').match('/*.py')
570570
False
571571

572+
The *pattern* may be another path object; this speeds up matching the same
573+
pattern against multiple files::
574+
575+
>>> pattern = PurePath('*.py')
576+
>>> PurePath('a/b.py').match(pattern)
577+
True
578+
572579
As with other methods, case-sensitivity follows platform defaults::
573580

574581
>>> PurePosixPath('b.py').match('*.PY')
@@ -581,6 +588,10 @@ Pure paths provide the following methods and properties:
581588
.. versionadded:: 3.12
582589
The *case_sensitive* argument.
583590

591+
.. versionchanged:: 3.13
592+
Support for the recursive wildcard "``**``" was added. In previous
593+
versions, it acted like the non-recursive wildcard "``*``".
594+
584595

585596
.. method:: PurePath.relative_to(other, walk_up=False)
586597

0 commit comments

Comments
 (0)