Skip to content

Commit b248777

Browse files
authored
Merge branch 'main' into pythongh-105793-is-dir-follow-symlinks
2 parents a1a7039 + 4a6c84f commit b248777

110 files changed

Lines changed: 3652 additions & 1787 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: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,9 @@ jobs:
8787
with:
8888
filter: |
8989
Doc/**
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/**
90+
Misc/**
10491
.github/workflows/reusable-docs.yml
92+
format: csv # works for paths with spaces
10593
- name: Check for docs changes
10694
if: >-
10795
github.event_name == 'pull_request'

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ jobs:
3838
uses: Ana06/get-changed-files@v2.2.0
3939
with:
4040
filter: "Doc/**"
41+
format: csv # works for paths with spaces
4142
- name: 'Build changed files in nit-picky mode'
4243
if: github.event_name == 'pull_request'
4344
continue-on-error: true
4445
run: |
46+
set -Eeuo pipefail
4547
# Mark files the pull request modified
46-
touch ${{ steps.changed_files.outputs.added_modified }}
48+
python Doc/tools/touch-clean-files.py --clean '${{ steps.changed_files.outputs.added_modified }}'
4749
# Build docs with the '-n' (nit-picky) option; convert warnings to annotations
4850
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n --keep-going" html 2>&1 |
4951
python Doc/tools/warnings-to-gh-actions.py

‎Doc/c-api/bool.rst‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Boolean Objects
66
---------------
77

88
Booleans in Python are implemented as a subclass of integers. There are only
9-
two booleans, :const:`Py_False` and :const:`Py_True`. As such, the normal
9+
two booleans, :c:data:`Py_False` and :c:data:`Py_True`. As such, the normal
1010
creation and deletion functions don't apply to booleans. The following macros
1111
are available, however.
1212

@@ -19,29 +19,32 @@ are available, however.
1919
2020
.. c:var:: PyObject* Py_False
2121
22-
The Python ``False`` object. This object has no methods. It needs to be
23-
treated just like any other object with respect to reference counts.
22+
The Python ``False`` object. This object has no methods and is
23+
`immortal <https://peps.python.org/pep-0683/>`_.
24+
25+
.. versionchanged:: 3.12
26+
:c:data:`Py_False` is immortal.
2427
2528
2629
.. c:var:: PyObject* Py_True
2730
28-
The Python ``True`` object. This object has no methods. It needs to be treated
29-
just like any other object with respect to reference counts.
31+
The Python ``True`` object. This object has no methods and is
32+
`immortal <https://peps.python.org/pep-0683/>`_.
33+
34+
.. versionchanged:: 3.12
35+
:c:data:`Py_True` is immortal.
3036
3137
3238
.. c:macro:: Py_RETURN_FALSE
3339
34-
Return :const:`Py_False` from a function, properly incrementing its reference
35-
count.
40+
Return :c:data:`Py_False` from a function.
3641
3742
3843
.. c:macro:: Py_RETURN_TRUE
3944
40-
Return :const:`Py_True` from a function, properly incrementing its reference
41-
count.
45+
Return :c:data:`Py_True` from a function.
4246
4347
4448
.. c:function:: PyObject* PyBool_FromLong(long v)
4549
46-
Return a new reference to :const:`Py_True` or :const:`Py_False` depending on the
47-
truth value of *v*.
50+
Return :c:data:`Py_True` or :c:data:`Py_False`, depending on the truth value of *v*.

‎Doc/c-api/import.rst‎

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,40 @@ Importing Modules
9898
an exception set on failure (the module still exists in this case).
9999
100100
101-
.. c:function:: PyObject* PyImport_AddModuleObject(PyObject *name)
101+
.. c:function:: PyObject* PyImport_AddModuleRef(const char *name)
102+
103+
Return the module object corresponding to a module name.
104+
105+
The *name* argument may be of the form ``package.module``. First check the
106+
modules dictionary if there's one there, and if not, create a new one and
107+
insert it in the modules dictionary.
108+
109+
Return a :term:`strong reference` to the module on success. Return ``NULL``
110+
with an exception set on failure.
102111
103-
Return the module object corresponding to a module name. The *name* argument
104-
may be of the form ``package.module``. First check the modules dictionary if
105-
there's one there, and if not, create a new one and insert it in the modules
106-
dictionary. Return ``NULL`` with an exception set on failure.
112+
The module name *name* is decoded from UTF-8.
107113
108-
.. note::
114+
This function does not load or import the module; if the module wasn't
115+
already loaded, you will get an empty module object. Use
116+
:c:func:`PyImport_ImportModule` or one of its variants to import a module.
117+
Package structures implied by a dotted name for *name* are not created if
118+
not already present.
119+
120+
.. versionadded:: 3.13
121+
122+
123+
.. c:function:: PyObject* PyImport_AddModuleObject(PyObject *name)
109124
110-
This function does not load or import the module; if the module wasn't already
111-
loaded, you will get an empty module object. Use :c:func:`PyImport_ImportModule`
112-
or one of its variants to import a module. Package structures implied by a
113-
dotted name for *name* are not created if not already present.
125+
Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed
126+
reference` and *name* is a Python :class:`str` object.
114127
115128
.. versionadded:: 3.3
116129
117130
118131
.. c:function:: PyObject* PyImport_AddModule(const char *name)
119132
120-
Similar to :c:func:`PyImport_AddModuleObject`, but the name is a UTF-8
121-
encoded string instead of a Unicode object.
133+
Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed
134+
reference`.
122135
123136
124137
.. c:function:: PyObject* PyImport_ExecCodeModule(const char *name, PyObject *co)

‎Doc/c-api/none.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ same reason.
1515

1616
.. c:var:: PyObject* Py_None
1717
18-
The Python ``None`` object, denoting lack of value. This object has no methods.
19-
It needs to be treated just like any other object with respect to reference
20-
counts.
18+
The Python ``None`` object, denoting lack of value. This object has no methods
19+
and is `immortal <https://peps.python.org/pep-0683/>`_.
2120

21+
.. versionchanged:: 3.12
22+
:c:data:`Py_None` is immortal.
2223

2324
.. c:macro:: Py_RETURN_NONE
2425
25-
Properly handle returning :c:data:`Py_None` from within a C function (that is,
26-
increment the reference count of ``None`` and return it.)
26+
Return :c:data:`Py_None` from a function.

‎Doc/c-api/slice.rst‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ Ellipsis Object
118118
119119
.. c:var:: PyObject *Py_Ellipsis
120120
121-
The Python ``Ellipsis`` object. This object has no methods. It needs to be
122-
treated just like any other object with respect to reference counts. Like
123-
:c:data:`Py_None` it is a singleton object.
121+
The Python ``Ellipsis`` object. This object has no methods. Like
122+
:c:data:`Py_None`, it is an `immortal <https://peps.python.org/pep-0683/>`_.
123+
singleton object.
124+
125+
.. versionchanged:: 3.12
126+
:c:data:`Py_Ellipsis` is immortal.

‎Doc/c-api/weakref.rst‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ simple reference object, and the second acts as a proxy for the original object
1111
as much as it can.
1212

1313

14-
.. c:function:: int PyWeakref_Check(ob)
14+
.. c:function:: int PyWeakref_Check(PyObject *ob)
1515
16-
Return true if *ob* is either a reference or proxy object. This function
16+
Return non-zero if *ob* is either a reference or proxy object. This function
1717
always succeeds.
1818
1919
20-
.. c:function:: int PyWeakref_CheckRef(ob)
20+
.. c:function:: int PyWeakref_CheckRef(PyObject *ob)
2121
22-
Return true if *ob* is a reference object. This function always succeeds.
22+
Return non-zero if *ob* is a reference object. This function always succeeds.
2323
2424
25-
.. c:function:: int PyWeakref_CheckProxy(ob)
25+
.. c:function:: int PyWeakref_CheckProxy(PyObject *ob)
2626
27-
Return true if *ob* is a proxy object. This function always succeeds.
27+
Return non-zero if *ob* is a proxy object. This function always succeeds.
2828
2929
3030
.. c:function:: PyObject* PyWeakref_NewRef(PyObject *ob, PyObject *callback)
@@ -51,10 +51,21 @@ as much as it can.
5151
``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
5252
5353
54+
.. c:function:: int PyWeakref_GetRef(PyObject *ref, PyObject **pobj)
55+
56+
Get a :term:`strong reference` to the referenced object from a weak
57+
reference, *ref*, into *\*pobj*.
58+
Return 0 on success. Raise an exception and return -1 on error.
59+
60+
If the referent is no longer live, set *\*pobj* to ``NULL`` and return 0.
61+
62+
.. versionadded:: 3.13
63+
64+
5465
.. c:function:: PyObject* PyWeakref_GetObject(PyObject *ref)
5566
56-
Return the referenced object from a weak reference, *ref*. If the referent is
57-
no longer live, returns :const:`Py_None`.
67+
Return a :term:`borrowed reference` to the referenced object from a weak
68+
reference, *ref*. If the referent is no longer live, returns ``Py_None``.
5869
5970
.. note::
6071

‎Doc/data/refcounts.dat‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,9 @@ PyCoro_New:PyFrameObject*:frame:0:
974974
PyCoro_New:PyObject*:name:0:
975975
PyCoro_New:PyObject*:qualname:0:
976976

977+
PyImport_AddModuleRef:PyObject*::+1:
978+
PyImport_AddModuleRef:const char*:name::
979+
977980
PyImport_AddModule:PyObject*::0:reference borrowed from sys.modules
978981
PyImport_AddModule:const char*:name::
979982

@@ -1794,6 +1797,9 @@ PyObject_Size:PyObject*:o:0:
17941797
PyObject_Str:PyObject*::+1:
17951798
PyObject_Str:PyObject*:o:0:
17961799

1800+
Py_TYPE:PyObject*::0:
1801+
Py_TYPE:PyObject*:ob:0:
1802+
17971803
PyObject_Type:PyObject*::+1:
17981804
PyObject_Type:PyObject*:o:0:
17991805

@@ -2807,6 +2813,10 @@ PyWeakref_GET_OBJECT:PyObject*:ref:0:
28072813
PyWeakref_GetObject:PyObject*::0:
28082814
PyWeakref_GetObject:PyObject*:ref:0:
28092815

2816+
PyWeakref_GetRef:int:::
2817+
PyWeakref_GetRef:PyObject*:ref:0:
2818+
PyWeakref_GetRef:PyObject**:pobj:+1:
2819+
28102820
PyWeakref_NewProxy:PyObject*::+1:
28112821
PyWeakref_NewProxy:PyObject*:ob:0:
28122822
PyWeakref_NewProxy:PyObject*:callback:0:

‎Doc/data/stable_abi.dat‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Doc/library/exceptions.rst‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,11 @@ their subgroups based on the types of the contained exceptions.
912912
Returns an exception group that contains only the exceptions from the
913913
current group that match *condition*, or ``None`` if the result is empty.
914914

915-
The condition can be either a function that accepts an exception and returns
916-
true for those that should be in the subgroup, or it can be an exception type
917-
or a tuple of exception types, which is used to check for a match using the
918-
same check that is used in an ``except`` clause.
915+
The condition can be an exception type or tuple of exception types, in which
916+
case each exception is checked for a match using the same check that is used
917+
in an ``except`` clause. The condition can also be a callable (other than
918+
a type object) that accepts an exception as its single argument and returns
919+
true for the exceptions that should be in the subgroup.
919920

920921
The nesting structure of the current exception is preserved in the result,
921922
as are the values of its :attr:`message`, :attr:`__traceback__`,
@@ -926,6 +927,9 @@ their subgroups based on the types of the contained exceptions.
926927
including the top-level and any nested exception groups. If the condition is
927928
true for such an exception group, it is included in the result in full.
928929

930+
.. versionadded:: 3.13
931+
``condition`` can be any callable which is not a type object.
932+
929933
.. method:: split(condition)
930934

931935
Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where ``match``

0 commit comments

Comments
 (0)