10000 Merge remote-tracking branch 'upstream/main' into gh-100239 · iritkatriel/cpython@c74a196 · GitHub
[go: up one dir, main page]

Skip to content

Commit c74a196

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pythongh-100239
2 parents efe8e0c + ff3e145 commit c74a196

File tree

114 files changed

+2881
-1042
lines changed
F438

Some content is hidden

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

114 files changed

+2881
-1042
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/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/ctypes.rst

Lines changed: 30 additions & 0 deletions
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

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

Doc/library/pdb.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,15 @@ slightly different way:
179179
.. versionadded:: 3.14
180180
The *commands* argument.
181181

182-
.. function:: post_mortem(traceback=None)
182+
.. function:: post_mortem(t=None)
183183

184-
Enter post-mortem debugging of the given *traceback* object. If no
185-
*traceback* is given, it uses the one of the exception that is currently
186-
being handled (an exception must be being handled if the default is to be
187-
used).
184+
Enter post-mortem debugging of the given exception or
185+
:ref:`traceback object <traceback-objects>`. If no value is given, it uses
186+
the exception that is currently being handled, or raises ``ValueError`` if
187+
there isn’t one.
188188

189+
.. versionchanged:: 3.13
190+
Support for exception objects was added.
189191

190192
.. function:: pm()
191193

Doc/library/stdtypes.rst

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,100 @@ objects that compare equal might have different :attr:`~range.start`,
15481548
single: str (built-in class); (see also string)
15491549
pair: object; string
15501550

1551+
.. _text-methods-summary:
1552+
1553+
Text and Binary Sequence Type Methods Summary
1554+
=============================================
1555+
The following table summarizes the text and binary sequence types methods by
1556+
category.
1557+
1558+
1559+
+--------------------------+-------------------------------------------+---------------------------------------------------+
1560+
| Category | :class:`str` methods | :class:`bytes` and :class:`bytearray` methods |
1561+
+==========================+===========================================+===================================================+
1562+
| Formatting | :meth:`str.format` | |
1563+
| +-------------------------------------------+---------------------------------------------------+
1564+
| | :meth:`str.format_map` | |
1565+
| +-------------------------------------------+---------------------------------------------------+
1566+
| | :ref:`f-strings` | |
1567+
| +-------------------------------------------+---------------------------------------------------+
1568+
| | :ref:`old-string-formatting` | :ref:`bytes-formatting` |
1569+
+--------------------------+------------------+------------------------+--------------------+------------------------------+
1570+
| Searching and Replacing | :meth:`str.find` | :meth:`str.rfind` | :meth:`bytes.find` | :meth:`bytes.rfind` |
1571+
| +------------------+------------------------+--------------------+------------------------------+
1572+
| | :meth:`str.index`| :meth:`str.rindex` | :meth:`bytes.index`| :meth:`bytes.rindex` |
1573+
| +------------------+------------------------+--------------------+------------------------------+
1574+
| | :meth:`str.startswith` | :meth:`bytes.startswith` |
1575+
| +-------------------------------------------+---------------------------------------------------+
1576+
| | :meth:`str.endswith` | :meth:`bytes.endswith` |
1577+
| +-------------------------------------------+---------------------------------------------------+
1578+
| | :meth:`str.count` | :meth:`bytes.count` |
1579+
| +-------------------------------------------+---------------------------------------------------+
1580+
| | :meth:`str.replace` | :meth:`bytes.replace` |
1581+
+--------------------------+-------------------+-----------------------+---------------------+-----------------------------+
1582+
| Splitting and Joining | :meth:`str.split` | :meth:`str.rsplit` | :meth:`bytes.split` | :meth:`bytes.rsplit` |
1583+
| +-------------------+-----------------------+---------------------+-----------------------------+
1584+
| | :meth:`str.splitlines` | :meth:`bytes.splitlines` |
1585+
| +-------------------------------------------+---------------------------------------------------+
1586+
| | :meth:`str.partition` | :meth:`bytes.partition` |
1587+
| +-------------------------------------------+---------------------------------------------------+
1588+
| | :meth:`str.rpartition` | :meth:`bytes.rpartition` |
1589+
| +-------------------------------------------+---------------------------------------------------+
1590+
| | :meth:`str.join` | :meth:`bytes.join` |
1591+
+--------------------------+-------------------------------------------+---------------------------------------------------+
1592+
| String Classification | :meth:`str.isalpha` | :meth:`bytes.isalpha` |
1593+
| +-------------------------------------------+---------------------------------------------------+
1594+
| | :meth:`str.isdecimal` | |
1595+
| +-------------------------------------------+---------------------------------------------------+
1596+
| | :meth:`str.isdigit` | :meth:`bytes.isdigit` |
1597+
| +-------------------------------------------+---------------------------------------------------+
1598+
| | :meth:`str.isnumeric` | |
1599+
| +-------------------------------------------+---------------------------------------------------+
1600+
| | :meth:`str.isalnum` | :meth:`bytes.isalnum` |
1601+
| +-------------------------------------------+---------------------------------------------------+
1602+
| | :meth:`str.isidentifier` | |
1603+
| +-------------------------------------------+---------------------------------------------------+
1604+
| | :meth:`str.islower` | :meth:`bytes.islower` |
1605+
| +-------------------------------------------+---------------------------------------------------+
1606+
| | :meth:`str.isupper` | :meth:`bytes.isupper` |
1607+
| +-------------------------------------------+---------------------------------------------------+
1608+
| | :meth:`str.istitle` | :meth:`bytes.istitle` |
1609+
| +-------------------------------------------+---------------------------------------------------+
1610+
| | :meth:`str.isspace` | :meth:`bytes.isspace` |
1611+
| +-------------------------------------------+---------------------------------------------------+
1612+
| | :meth:`str.isprintable` | |
1613+
+--------------------------+-------------------------------------------+---------------------------------------------------+
1614+
| Case Manipulation | :meth:`str.lower` | :meth:`bytes.lower` |
1615+
| +-------------------------------------------+---------------------------------------------------+
1616+
| | :meth:`str.upper` | :meth:`bytes.upper` |
1617+
| +-------------------------------------------+---------------------------------------------------+
1618+
| | :meth:`str.casefold` | |
1619+
| +-------------------------------------------+---------------------------------------------------+
1620+
| | :meth:`str.capitalize` | :meth:`bytes.capitalize` |
1621+
| +-------------------------------------------+---------------------------------------------------+
1622+
| | :meth:`str.title` | :meth:`bytes.title` |
1623+
| +-------------------------------------------+---------------------------------------------------+
1624+
| | :meth:`str.swapcase` | :meth:`bytes.swapcase` |
1625+
+--------------------------+-------------------+-----------------------+---------------------+-----------------------------+
1626+
| Padding and Stripping | :meth:`str.ljust` | :meth:`str.rjust` | :meth:`bytes.ljust` | :meth:`bytes.rjust` |
1627+
| +-------------------+-----------------------+---------------------+-----------------------------+
1628+
| | :meth:`str.center` | :meth:`bytes.center` |
1629+
| +-------------------------------------------+---------------------------------------------------+
1630+
| | :meth:`str.expandtabs` | :meth:`bytes.expandtabs` |
1631+
| +-------------------------------------------+---------------------------------------------------+
1632+
| | :meth:`str.strip` | :meth:`bytes.strip` |
1633+
| +--------------------+----------------------+----------------------+----------------------------+
1634+
| | :meth:`str.lstrip` | :meth:`str.rstrip` | :meth:`bytes.lstrip` | :meth:`bytes.rstrip` |
1635+
+--------------------------+--------------------+----------------------+----------------------+----------------------------+
1636+
| Translation and Encoding | :meth:`str.translate` | :meth:`bytes.translate` |
1637+
| +-------------------------------------------+---------------------------------------------------+
1638+
| | :meth:`str.maketrans` | :meth:`bytes.maketrans` |
1639+
| +-------------------------------------------+---------------------------------------------------+
1640+
| | :meth:`str.encode` | |
1641+
| +-------------------------------------------+---------------------------------------------------+
1642+
| | | :meth:`bytes.decode` |
1643+
+--------------------------+-------------------------------------------+---------------------------------------------------+
1644+
15511645
.. _textseq:
15521646

15531647
Text Sequence Type --- :class:`str`

Doc/library/sysconfig.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ Other functions
388388

389389
Windows will return one of:
390390

391-
- win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
391+
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
392+
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
392393
- win32 (all others - specifically, sys.platform is returned)
393394

394395
macOS can return:

0 commit comments

Comments
 (0)
0