Skip to content

Commit 6c9d056

Browse files
committed
Merge branch 'main' into pycfunctionobject_freelist
2 parents a76224b + 6e4f641 commit 6c9d056

File tree

218 files changed

+5372
-2142
lines changed

Some content is hidden

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

218 files changed

+5372
-2142
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@ Doc/library/site.rst @FFY00
9696
Lib/test/test_except*.py @iritkatriel
9797
Objects/exceptions.c @iritkatriel
9898

99-
# Hashing
100-
**/*hashlib* @gpshead @tiran
99+
# Hashing & cryptographic primitives
100+
**/*hashlib* @gpshead @tiran @picnixz
101101
**/*pyhash* @gpshead @tiran
102-
**/sha* @gpshead @tiran
103-
Modules/md5* @gpshead @tiran
104-
**/*blake* @gpshead @tiran
102+
**/sha* @gpshead @tiran @picnixz
103+
Modules/md5* @gpshead @tiran @picnixz
104+
**/*blake* @gpshead @tiran @picnixz
105105
Modules/_hacl/** @gpshead
106+
**/*hmac* @gpshead @picnixz
106107

107108
# logging
108109
**/*logging* @vsajip

.github/workflows/reusable-change-detection.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,22 @@ jobs:
8383
# into the PR branch anyway.
8484
#
8585
# https://github.com/python/core-workflow/issues/373
86-
git diff --name-only "origin/$GITHUB_BASE_REF.." | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$|\.md$|mypy\.ini$)' && echo "run-tests=true" >> "$GITHUB_OUTPUT" || true
86+
grep_ignore_args=(
87+
# file extensions
88+
-e '\.md$'
89+
-e '\.rst$'
90+
# top-level folders
91+
-e '^Doc/'
92+
-e '^Misc/'
93+
# configuration files
94+
-e '^\.github/CODEOWNERS$'
95+
-e '^\.pre-commit-config\.yaml$'
96+
-e '\.ruff\.toml$'
97+
-e 'mypy\.ini$'
98+
)
99+
git diff --name-only "origin/$GITHUB_BASE_REF.." \
100+
| grep -qvE "${grep_ignore_args[@]}" \
101+
&& echo "run-tests=true" >> "$GITHUB_OUTPUT" || true
87102
fi
88103
89104
# Check if we should run hypothesis tests

Doc/c-api/sys.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Operating System Utilities
234234
235235
The caller must hold the GIL.
236236
237-
.. versionadded:: next
237+
.. versionadded:: 3.14
238238
239239
240240
.. c:function:: int Py_fclose(FILE *file)
@@ -246,7 +246,7 @@ Operating System Utilities
246246
In either case, any further access (including another call to
247247
:c:func:`Py_fclose`) to the stream results in undefined behavior.
248248
249-
.. versionadded:: next
249+
.. versionadded:: 3.14
250250
251251
252252
.. _systemfunctions:

Doc/deprecations/pending-removal-in-3.16.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ Pending removal in Python 3.16
5757
In the rare case that you need the bitwise inversion of
5858
the underlying integer, convert to ``int`` explicitly (``~int(x)``).
5959

60+
* :mod:`functools`:
61+
62+
* Calling the Python implementation of :func:`functools.reduce` with *function*
63+
or *sequence* as keyword arguments has been deprecated since Python 3.14.
64+
6065
* :mod:`shutil`:
6166

6267
* The :class:`!ExecError` exception
@@ -79,8 +84,3 @@ Pending removal in Python 3.16
7984

8085
* The undocumented and unused :attr:`!TarFile.tarfile` attribute
8186
has been deprecated since Python 3.13.
82-
83-
* :mod:`functools`:
84-
85-
* Calling the Python implementation of :func:`functools.reduce` with *function*
86-
or *sequence* as keyword arguments has been deprecated since Python 3.14.

Doc/library/asyncio-eventloop.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ an event loop:
7373

7474
Set *loop* as the current event loop for the current OS thread.
7575

76-
.. deprecated:: next
76+
.. deprecated:: 3.14
7777
The :func:`set_event_loop` function is deprecated and will be removed
7878
in Python 3.16.
7979

Doc/library/asyncio-policy.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ for the current process:
4848

4949
Return the current process-wide policy.
5050

51-
.. deprecated:: next
51+
.. deprecated:: 3.14
5252
The :func:`get_event_loop_policy` function is deprecated and
5353
will be removed in Python 3.16.
5454

@@ -58,7 +58,7 @@ for the current process:
5858

5959
If *policy* is set to ``None``, the default policy is restored.
6060

61-
.. deprecated:: next
61+
.. deprecated:: 3.14
6262
The :func:`set_event_loop_policy` function is deprecated and
6363
will be removed in Python 3.16.
6464

@@ -95,7 +95,7 @@ The abstract event loop policy base class is defined as follows:
9595

9696
This method should never return ``None``.
9797

98-
.. deprecated:: next
98+
.. deprecated:: 3.14
9999
The :class:`AbstractEventLoopPolicy` class is deprecated and
100100
will be removed in Python 3.16.
101101

@@ -121,7 +121,7 @@ asyncio ships with the following built-in policies:
121121
The :meth:`get_event_loop` method of the default asyncio policy now
122122
raises a :exc:`RuntimeError` if there is no set event loop.
123123

124-
.. deprecated:: next
124+
.. deprecated:: 3.14
125125
The :class:`DefaultEventLoopPolicy` class is deprecated and
126126
will be removed in Python 3.16.
127127

@@ -133,7 +133,7 @@ asyncio ships with the following built-in policies:
133133

134134
.. availability:: Windows.
135135

136-
.. deprecated:: next
136+
.. deprecated:: 3.14
137137
The :class:`WindowsSelectorEventLoopPolicy` class is deprecated and
138138
will be removed in Python 3.16.
139139

@@ -145,7 +145,7 @@ asyncio ships with the following built-in policies:
145145

146146
.. availability:: Windows.
147147

148-
.. deprecated:: next
148+
.. deprecated:: 3.14
149149
The :class:`WindowsProactorEventLoopPolicy` class is deprecated and
150150
will be removed in Python 3.16.
151151

Doc/library/calendar.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
173173
on the first weekday as specified in the constructor or set by the
174174
:meth:`setfirstweekday` method.
175175

176-
.. versionchanged:: next
176+
.. versionchanged:: 3.14
177177
If *highlight_day* is given, this date is highlighted in color.
178178
This can be :ref:`controlled using environment variables
179179
<using-on-controlling-color>`.
@@ -201,7 +201,7 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
201201
on the first weekday as specified in the constructor or set by the
202202
:meth:`setfirstweekday` method.
203203

204-
.. versionchanged:: next
204+
.. versionchanged:: 3.14
205205
If *highlight_day* is given, this date is highlighted in color.
206206
This can be :ref:`controlled using environment variables
207207
<using-on-controlling-color>`.
@@ -229,7 +229,7 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
229229
:meth:`setfirstweekday` method. The earliest year for which a calendar
230230
can be generated is platform-dependent.
231231

232-
.. versionchanged:: next
232+
.. versionchanged:: 3.14
233233
If *highlight_day* is given, this date is highlighted in color.
234234
This can be :ref:`controlled using environment variables
235235
<using-on-controlling-color>`.
@@ -727,7 +727,7 @@ The following options are accepted:
727727
The number of months printed per row.
728728
Defaults to 3.
729729

730-
.. versionchanged:: next
730+
.. versionchanged:: 3.14
731731
By default, today's date is highlighted in color and can be
732732
:ref:`controlled using environment variables <using-on-controlling-color>`.
733733

Doc/library/ctypes.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,36 @@ invalid non-\ ``NULL`` pointers would crash Python)::
870870
ValueError: NULL pointer access
871871
>>>
872872

873+
.. _ctypes-thread-safety:
874+
875+
Thread safety without the GIL
876+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
877+
878+
In Python 3.13, the :term:`GIL` may be disabled on :term:`experimental free threaded <free threading>` builds.
879+
In ctypes, reads and writes to a single object concurrently is safe, but not across multiple objects:
880+
881+
.. code-block:: pycon
882+
883+
>>> number = c_int(42)
884+
>>> pointer_a = pointer(number)
885+
>>> pointer_b = pointer(number)
886+
887+
In the above, it's only safe for one object to read and write to the address at once if the GIL is disabled.
888+
So, ``pointer_a`` can be shared and written to across multiple threads, but only if ``pointer_b``
889+
is not also attempting to do the same. If this is an issue, consider using a :class:`threading.Lock`
890+
to synchronize access to memory:
891+
892+
.. code-block:: pycon
893+
894+
>>> import threading
895+
>>> lock = threading.Lock()
896+
>>> # Thread 1
897+
>>> with lock:
898+
... pointer_a.contents = 24
899+
>>> # Thread 2
900+
>>> with lock:
901+
... pointer_b.contents = 42
902+
873903
874904
.. _ctypes-type-conversions:
875905

@@ -2203,7 +2233,7 @@ Utility functions
22032233

22042234
.. audit-event:: ctypes.memoryview_at address,size,readonly
22052235

2206-
.. versionadded:: next
2236+
.. versionadded:: 3.14
22072237

22082238

22092239
.. _ctypes-data-types:

Doc/library/faulthandler.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Fault handler state
9191
The dump now mentions if a garbage collector collection is running
9292
if *all_threads* is true.
9393

94-
.. versionchanged:: next
94+
.. versionchanged:: 3.14
9595
Only the current thread is dumped if the :term:`GIL` is disabled to
9696
prevent the risk of data races.
9797

Doc/library/fnmatch.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ module. See module :mod:`glob` for pathname expansion (:mod:`glob` uses
4646
a period are not special for this module, and are matched by the ``*`` and ``?``
4747
patterns.
4848

49-
Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is used to
50-
cache the compiled regex patterns in the following functions: :func:`fnmatch`,
51-
:func:`fnmatchcase`, :func:`.filter`.
49+
Unless stated otherwise, "filename string" and "pattern string" either refer to
50+
:class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note that the
51+
functions documented below do not allow to mix a :class:`!bytes` pattern with
52+
a :class:`!str` filename, and vice-versa.
53+
54+
Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768
55+
is used to cache the (typed) compiled regex patterns in the following
56+
functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`.
57+
5258

5359
.. function:: fnmatch(name, pat)
5460

@@ -78,16 +84,16 @@ cache the compiled regex patterns in the following functions: :func:`fnmatch`,
7884

7985
.. function:: filter(names, pat)
8086

81-
Construct a list from those elements of the :term:`iterable` *names*
82-
that match pattern *pat*.
87+
Construct a list from those elements of the :term:`iterable` of filename
88+
strings *names* that match the pattern string *pat*.
8389
It is the same as ``[n for n in names if fnmatch(n, pat)]``,
8490
but implemented more efficiently.
8591

8692

8793
.. function:: translate(pat)
8894

8995
Return the shell-style pattern *pat* converted to a regular expression for
90-
using with :func:`re.match`.
96+
using with :func:`re.match`. The pattern is expected to be a :class:`str`.
9197

9298
Example:
9399

0 commit comments

Comments
 (0)