Skip to content

Commit 338e2fc

Browse files
authored
Merge branch 'main' into idledos
2 parents 0b3c5b6 + 60181f4 commit 338e2fc

42 files changed

Lines changed: 2129 additions & 898 deletions

Some content is hidden

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

Doc/howto/perf_profiling.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Then we can use ``perf report`` to analyze the data:
9292
| | | |
9393
| | | |--51.67%--_PyEval_EvalFrameDefault
9494
| | | | |
95-
| | | | |--11.52%--_PyLong_Add
95+
| | | | |--11.52%--_PyCompactLong_Add
9696
| | | | | |
9797
| | | | | |--2.97%--_PyObject_Malloc
9898
...
@@ -142,7 +142,7 @@ Instead, if we run the same experiment with ``perf`` support enabled we get:
142142
| | | |
143143
| | | |--51.81%--_PyEval_EvalFrameDefault
144144
| | | | |
145-
| | | | |--13.77%--_PyLong_Add
145+
| | | | |--13.77%--_PyCompactLong_Add
146146
| | | | | |
147147
| | | | | |--3.26%--_PyObject_Malloc
148148

Doc/library/email.header.rst

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,36 @@ The :mod:`email.header` module also provides the following convenient functions.
178178
Decode a message header value without converting the character set. The header
179179
value is in *header*.
180180

181-
This function returns a list of ``(decoded_string, charset)`` pairs containing
182-
each of the decoded parts of the header. *charset* is ``None`` for non-encoded
183-
parts of the header, otherwise a lower case string containing the name of the
184-
character set specified in the encoded string.
181+
For historical reasons, this function may return either:
185182

186-
Here's an example::
183+
1. A list of pairs containing each of the decoded parts of the header,
184+
``(decoded_bytes, charset)``, where *decoded_bytes* is always an instance of
185+
:class:`bytes`, and *charset* is either:
186+
187+
- A lower case string containing the name of the character set specified.
188+
189+
- ``None`` for non-encoded parts of the header.
190+
191+
2. A list of length 1 containing a pair ``(string, None)``, where
192+
*string* is always an instance of :class:`str`.
193+
194+
An :exc:`email.errors.HeaderParseError` may be raised when certain decoding
195+
errors occur (e.g. a base64 decoding exception).
196+
197+
Here are examples:
187198

188199
>>> from email.header import decode_header
189200
>>> decode_header('=?iso-8859-1?q?p=F6stal?=')
190201
[(b'p\xf6stal', 'iso-8859-1')]
202+
>>> decode_header('unencoded_string')
203+
[('unencoded_string', None)]
204+
>>> decode_header('bar =?utf-8?B?ZsOzbw==?=')
205+
[(b'bar ', None), (b'f\xc3\xb3o', 'utf-8')]
206+
207+
.. note::
208+
209+
This function exists for for backwards compatibility only. For
210+
new code, we recommend using :class:`email.headerregistry.HeaderRegistry`.
191211

192212

193213
.. function:: make_header(decoded_seq, maxlinelen=None, header_name=None, continuation_ws=' ')
@@ -203,3 +223,7 @@ The :mod:`email.header` module also provides the following convenient functions.
203223
:class:`Header` instance. Optional *maxlinelen*, *header_name*, and
204224
*continuation_ws* are as in the :class:`Header` constructor.
205225

226+
.. note::
227+
228+
This function exists for for backwards compatibility only, and is
229+
not recommended for use in new code.

Doc/library/sys.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,13 @@ always available. Unless explicitly noted otherwise, all variables are read-only
19331933
interpreter is pre-release (alpha, beta, or release candidate) then the
19341934
local and remote interpreters must be the same exact version.
19351935

1936+
.. audit-event:: remote_debugger_script script_path
1937+
1938+
When the script is executed in the remote process, an
1939+
:ref:`auditing event <auditing>`
1940+
``sys.remote_debugger_script`` is raised
1941+
with the path in the remote process.
1942+
19361943
.. availability:: Unix, Windows.
19371944
.. versionadded:: 3.14
19381945

Doc/reference/expressions.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,9 @@ brackets or curly braces.
406406
Variables used in the generator expression are evaluated lazily when the
407407
:meth:`~generator.__next__` method is called for the generator object (in the same
408408
fashion as normal generators). However, the iterable expression in the
409-
leftmost :keyword:`!for` clause is immediately evaluated, so that an error
410-
produced by it will be emitted at the point where the generator expression
409+
leftmost :keyword:`!for` clause is immediately evaluated, and the
410+
:term:`iterator` is immediately created for that iterable, so that an error
411+
produced while creating the iterator will be emitted at the point where the generator expression
411412
is defined, rather than at the point where the first value is retrieved.
412413
Subsequent :keyword:`!for` clauses and any filter condition in the leftmost
413414
:keyword:`!for` clause cannot be evaluated in the enclosing scope as they may

Doc/using/configure.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,14 @@ Options for third-party dependencies
445445
C compiler and linker flags for ``libuuid``, used by :mod:`uuid` module,
446446
overriding ``pkg-config``.
447447

448+
.. option:: LIBZSTD_CFLAGS
449+
.. option:: LIBZSTD_LIBS
450+
451+
C compiler and linker flags for ``libzstd``, used by :mod:`compression.zstd` module,
452+
overriding ``pkg-config``.
453+
454+
.. versionadded:: 3.14
455+
448456
.. option:: PANEL_CFLAGS
449457
.. option:: PANEL_LIBS
450458

Doc/whatsnew/3.14.rst

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -816,43 +816,58 @@ Executing the new tool on the running process will yield a table like this:
816816
817817
python -m asyncio ps 12345
818818
819-
tid task id task name coroutine chain awaiter name awaiter id
820-
---------------------------------------------------------------------------------------------------------------------------------------
821-
8138752 0x564bd3d0210 Task-1 0x0
822-
8138752 0x564bd3d0410 Sundowning _aexit -> __aexit__ -> main Task-1 0x564bd3d0210
823-
8138752 0x564bd3d0610 TMBTE _aexit -> __aexit__ -> main Task-1 0x564bd3d0210
824-
8138752 0x564bd3d0810 TNDNBTG _aexit -> __aexit__ -> album Sundowning 0x564bd3d0410
825-
8138752 0x564bd3d0a10 Levitate _aexit -> __aexit__ -> album Sundowning 0x564bd3d0410
826-
8138752 0x564bd3e0550 DYWTYLM _aexit -> __aexit__ -> album TMBTE 0x564bd3d0610
827-
8138752 0x564bd3e0710 Aqua Regia _aexit -> __aexit__ -> album TMBTE 0x564bd3d0610
828-
829-
830-
or:
819+
tid task id task name coroutine stack awaiter chain awaiter name awaiter id
820+
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
821+
1935500 0x7fc930c18050 Task-1 TaskGroup._aexit -> TaskGroup.__aexit__ -> main 0x0
822+
1935500 0x7fc930c18230 Sundowning TaskGroup._aexit -> TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> main Task-1 0x7fc930c18050
823+
1935500 0x7fc93173fa50 TMBTE TaskGroup._aexit -> TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> main Task-1 0x7fc930c18050
824+
1935500 0x7fc93173fdf0 TNDNBTG sleep -> play TaskGroup._aexit -> TaskGroup.__aexit__ -> album Sundowning 0x7fc930c18230
825+
1935500 0x7fc930d32510 Levitate sleep -> play TaskGroup._aexit -> TaskGroup.__aexit__ -> album Sundowning 0x7fc930c18230
826+
1935500 0x7fc930d32890 DYWTYLM sleep -> play TaskGroup._aexit -> TaskGroup.__aexit__ -> album TMBTE 0x7fc93173fa50
827+
1935500 0x7fc93161ec30 Aqua Regia sleep -> play TaskGroup._aexit -> TaskGroup.__aexit__ -> album TMBTE 0x7fc93173fa50
828+
829+
or a tree like this:
831830

832831
.. code-block:: bash
833832
834833
python -m asyncio pstree 12345
835834
836835
└── (T) Task-1
837-
└── main
838-
└── __aexit__
839-
└── _aexit
836+
└── main example.py:13
837+
└── TaskGroup.__aexit__ Lib/asyncio/taskgroups.py:72
838+
└── TaskGroup._aexit Lib/asyncio/taskgroups.py:121
840839
├── (T) Sundowning
841-
│ └── album
842-
│ └── __aexit__
843-
│ └── _aexit
840+
│ └── album example.py:8
841+
│ └── TaskGroup.__aexit__ Lib/asyncio/taskgroups.py:72
842+
│ └── TaskGroup._aexit Lib/asyncio/taskgroups.py:121
844843
│ ├── (T) TNDNBTG
844+
│ │ └── play example.py:4
845+
│ │ └── sleep Lib/asyncio/tasks.py:702
845846
│ └── (T) Levitate
847+
│ └── play example.py:4
848+
│ └── sleep Lib/asyncio/tasks.py:702
846849
└── (T) TMBTE
847-
└── album
848-
└── __aexit__
849-
└── _aexit
850+
└── album example.py:8
851+
└── TaskGroup.__aexit__ Lib/asyncio/taskgroups.py:72
852+
└── TaskGroup._aexit Lib/asyncio/taskgroups.py:121
850853
├── (T) DYWTYLM
854+
│ └── play example.py:4
855+
│ └── sleep Lib/asyncio/tasks.py:702
851856
└── (T) Aqua Regia
857+
└── play example.py:4
858+
└── sleep Lib/asyncio/tasks.py:702
852859
853860
If a cycle is detected in the async await graph (which could indicate a
854861
programming issue), the tool raises an error and lists the cycle paths that
855-
prevent tree construction.
862+
prevent tree construction:
863+
864+
.. code-block:: bash
865+
866+
python -m asyncio pstree 12345
867+
868+
ERROR: await-graph contains cycles - cannot print a tree!
869+
870+
cycle: Task-2 → Task-3 → Task-2
856871
857872
(Contributed by Pablo Galindo, Łukasz Langa, Yury Selivanov, and Marta
858873
Gomez Macias in :gh:`91048`.)
@@ -1244,6 +1259,14 @@ concurrent.futures
12441259
buffer.
12451260
(Contributed by Enzo Bonnal and Josh Rosenberg in :gh:`74028`.)
12461261

1262+
configparser
1263+
------------
1264+
1265+
* Security fix: will no longer write config files it cannot read. Attempting
1266+
to :meth:`configparser.ConfigParser.write` keys containing delimiters or
1267+
beginning with the section header pattern will raise a
1268+
:class:`configparser.InvalidWriteError`.
1269+
(Contributed by Jacob Lincoln in :gh:`129270`)
12471270

12481271
contextvars
12491272
-----------

Include/internal/pycore_long.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ PyAPI_DATA(PyObject*) _PyLong_Rshift(PyObject *, int64_t);
112112
// Export for 'math' shared extension
113113
PyAPI_DATA(PyObject*) _PyLong_Lshift(PyObject *, int64_t);
114114

115-
PyAPI_FUNC(PyObject*) _PyLong_Add(PyLongObject *left, PyLongObject *right);
116-
PyAPI_FUNC(PyObject*) _PyLong_Multiply(PyLongObject *left, PyLongObject *right);
117-
PyAPI_FUNC(PyObject*) _PyLong_Subtract(PyLongObject *left, PyLongObject *right);
115+
PyAPI_FUNC(PyObject*) _PyCompactLong_Add(PyLongObject *left, PyLongObject *right);
116+
PyAPI_FUNC(PyObject*) _PyCompactLong_Multiply(PyLongObject *left, PyLongObject *right);
117+
PyAPI_FUNC(PyObject*) _PyCompactLong_Subtract(PyLongObject *left, PyLongObject *right);
118118

119119
// Export for 'binascii' shared extension.
120120
PyAPI_DATA(unsigned char) _PyLong_DigitValue[256];

Include/internal/pycore_opcode_metadata.h

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

Include/internal/pycore_uop_metadata.h

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

0 commit comments

Comments
 (0)