Skip to content

Commit 508f4b8

Browse files
Merge branch 'main' into hotfix/148263
2 parents 8043004 + bfe6f9f commit 508f4b8

File tree

19 files changed

+492
-265
lines changed

19 files changed

+492
-265
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Lib/test/xmltestdata/* noeol
3434
Lib/venv/scripts/common/activate text eol=lf
3535
Lib/venv/scripts/posix/* text eol=lf
3636

37+
# Prevent GitHub's web conflict editor from converting LF to CRLF
38+
*.rst text eol=lf
39+
3740
# CRLF files
3841
[attr]dos text eol=crlf
3942

.github/workflows/mypy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919
- "Tools/build/consts_getter.py"
2020
- "Tools/build/deepfreeze.py"
2121
- "Tools/build/generate-build-details.py"
22+
- "Tools/build/generate_levenshtein_examples.py"
2223
- "Tools/build/generate_sbom.py"
2324
- "Tools/build/generate_stdlib_module_names.py"
2425
- "Tools/build/mypy.ini"

.github/workflows/reusable-san.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,15 @@ jobs:
4040
# Install clang
4141
wget https://apt.llvm.org/llvm.sh
4242
chmod +x llvm.sh
43+
sudo ./llvm.sh 20
44+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 100
45+
sudo update-alternatives --set clang /usr/bin/clang-20
46+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 100
47+
sudo update-alternatives --set clang++ /usr/bin/clang++-20
4348
4449
if [ "${SANITIZER}" = "TSan" ]; then
45-
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken
46-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100
47-
sudo update-alternatives --set clang /usr/bin/clang-17
48-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100
49-
sudo update-alternatives --set clang++ /usr/bin/clang++-17
5050
# Reduce ASLR to avoid TSan crashing
5151
sudo sysctl -w vm.mmap_rnd_bits=28
52-
else
53-
sudo ./llvm.sh 20
5452
fi
5553
5654
- name: Sanitizer option setup

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Pending removal in Python 3.17
3535

3636
- Passing non-ascii *encoding* names to :func:`encodings.normalize_encoding`
3737
is deprecated and scheduled for removal in Python 3.17.
38-
(Contributed by Stan Ulbrych in :gh:`136702`)
38+
(Contributed by Stan Ulbrych in :gh:`136702`.)
3939

4040
* :mod:`typing`:
4141

Doc/library/multiprocessing.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,12 +1336,12 @@ Connection objects are usually created using
13361336
Note that multiple connection objects may be polled at once by
13371337
using :func:`multiprocessing.connection.wait`.
13381338

1339-
.. method:: send_bytes(buffer[, offset[, size]])
1339+
.. method:: send_bytes(buf[, offset[, size]])
13401340

13411341
Send byte data from a :term:`bytes-like object` as a complete message.
13421342

1343-
If *offset* is given then data is read from that position in *buffer*. If
1344-
*size* is given then that many bytes will be read from buffer. Very large
1343+
If *offset* is given then data is read from that position in *buf*. If
1344+
*size* is given then that many bytes will be read from *buf*. Very large
13451345
buffers (approximately 32 MiB+, though it depends on the OS) may raise a
13461346
:exc:`ValueError` exception
13471347

@@ -1361,18 +1361,18 @@ Connection objects are usually created using
13611361
alias of :exc:`OSError`.
13621362

13631363

1364-
.. method:: recv_bytes_into(buffer[, offset])
1364+
.. method:: recv_bytes_into(buf[, offset])
13651365

1366-
Read into *buffer* a complete message of byte data sent from the other end
1366+
Read into *buf* a complete message of byte data sent from the other end
13671367
of the connection and return the number of bytes in the message. Blocks
13681368
until there is something to receive. Raises
13691369
:exc:`EOFError` if there is nothing left to receive and the other end was
13701370
closed.
13711371

1372-
*buffer* must be a writable :term:`bytes-like object`. If
1372+
*buf* must be a writable :term:`bytes-like object`. If
13731373
*offset* is given then the message will be written into the buffer from
13741374
that position. Offset must be a non-negative integer less than the
1375-
length of *buffer* (in bytes).
1375+
length of *buf* (in bytes).
13761376

13771377
If the buffer is too short then a :exc:`BufferTooShort` exception is
13781378
raised and the complete message is available as ``e.args[0]`` where ``e``

Doc/using/android.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Adding Python to an Android app
3030
Most app developers should use one of the following tools, which will provide a
3131
much easier experience:
3232

33-
* `Briefcase <https://briefcase.readthedocs.io>`__, from the BeeWare project
33+
* `Briefcase <https://briefcase.beeware.org>`__, from the BeeWare project
3434
* `Buildozer <https://buildozer.readthedocs.io>`__, from the Kivy project
3535
* `Chaquopy <https://chaquo.com/chaquopy>`__
3636
* `pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__

Doc/whatsnew/3.15.rst

Lines changed: 56 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ In the case where loading a lazily imported module fails (for example, if
142142
the module does not exist), Python raises the exception at the point of
143143
first use rather than at import time. The associated traceback includes both
144144
the location where the name was accessed and the original import statement,
145-
making it straightforward to diagnose & debug the failure.
145+
making it straightforward to diagnose and debug the failure.
146146

147147
For cases where you want to enable lazy loading globally without modifying
148148
source code, Python provides the :option:`-X lazy_imports <-X>` command-line
@@ -451,14 +451,36 @@ Improved error messages
451451
452452
Running this code now produces a clearer suggestion:
453453

454-
.. code-block:: pycon
454+
.. code-block:: pytb
455455
456456
Traceback (most recent call last):
457-
File "/home/pablogsal/github/python/main/lel.py", line 42, in <module>
458-
print(container.area)
459-
^^^^^^^^^^^^^^
457+
File "/home/pablogsal/github/python/main/lel.py", line 42, in <module>
458+
print(container.area)
459+
^^^^^^^^^^^^^^
460460
AttributeError: 'Container' object has no attribute 'area'. Did you mean '.inner.area' instead of '.area'?
461461
462+
* The interpreter now tries to provide a suggestion when
463+
:func:`delattr` fails due to a missing attribute.
464+
When an attribute name that closely resembles an existing attribute is used,
465+
the interpreter will suggest the correct attribute name in the error message.
466+
For example:
467+
468+
.. doctest::
469+
470+
>>> class A:
471+
... pass
472+
>>> a = A()
473+
>>> a.abcde = 1
474+
>>> del a.abcdf # doctest: +ELLIPSIS
475+
Traceback (most recent call last):
476+
...
477+
AttributeError: 'A' object has no attribute 'abcdf'. Did you mean: 'abcde'?
478+
479+
(Contributed by Nikita Sobolev and Pranjal Prajapati in :gh:`136588`.)
480+
481+
* Several error messages incorrectly using the term "argument" have been corrected.
482+
(Contributed by Stan Ulbrych in :gh:`133382`.)
483+
462484

463485
Other language changes
464486
======================
@@ -490,28 +512,6 @@ Other language changes
490512

491513
(Contributed by Adam Turner in :gh:`133711`; PEP 686 written by Inada Naoki.)
492514

493-
* Several error messages incorrectly using the term "argument" have been corrected.
494-
(Contributed by Stan Ulbrych in :gh:`133382`.)
495-
496-
* The interpreter now tries to provide a suggestion when
497-
:func:`delattr` fails due to a missing attribute.
498-
When an attribute name that closely resembles an existing attribute is used,
499-
the interpreter will suggest the correct attribute name in the error message.
500-
For example:
501-
502-
.. doctest::
503-
504-
>>> class A:
505-
... pass
506-
>>> a = A()
507-
>>> a.abcde = 1
508-
>>> del a.abcdf # doctest: +ELLIPSIS
509-
Traceback (most recent call last):
510-
...
511-
AttributeError: 'A' object has no attribute 'abcdf'. Did you mean: 'abcde'?
512-
513-
(Contributed by Nikita Sobolev and Pranjal Prajapati in :gh:`136588`.)
514-
515515
* Unraisable exceptions are now highlighted with color by default. This can be
516516
controlled by :ref:`environment variables <using-on-controlling-color>`.
517517
(Contributed by Peter Bierma in :gh:`134170`.)
@@ -708,7 +708,7 @@ base64
708708
(Contributed by Serhiy Storchaka in :gh:`143214` and :gh:`146431`.)
709709

710710
* Added the *ignorechars* parameter in :func:`~base64.b16decode`,
711-
:func:`~base64.b32decode`, :func:`~base64.b32hexdecode`,
711+
:func:`~base64.b32decode`, :func:`~base64.b32hexdecode`,
712712
:func:`~base64.b64decode`, :func:`~base64.b85decode`, and
713713
:func:`~base64.z85decode`.
714714
(Contributed by Serhiy Storchaka in :gh:`144001` and :gh:`146431`.)
@@ -880,13 +880,13 @@ inspect
880880
json
881881
----
882882

883-
* Add the *array_hook* parameter to :func:`~json.load` and
883+
* Add the *array_hook* parameter to :func:`~json.load` and
884884
:func:`~json.loads` functions:
885885
allow a callback for JSON literal array types to customize Python lists in
886886
the resulting decoded object. Passing combined :class:`frozendict` to
887887
*object_pairs_hook* param and :class:`tuple` to ``array_hook`` will yield a
888888
deeply nested immutable Python structure representing the JSON data.
889-
(Contributed by Joao S. O. Bueno in :gh:`146440`)
889+
(Contributed by Joao S. O. Bueno in :gh:`146440`.)
890890

891891

892892
locale
@@ -914,23 +914,11 @@ math
914914
mimetypes
915915
---------
916916

917-
* Add ``application/dicom`` MIME type for ``.dcm`` extension.
918-
(Contributed by Benedikt Johannes in :gh:`144217`.)
919-
* Add ``application/efi``. (Contributed by Charlie Lin in :gh:`145720`.)
920-
* Add ``application/node`` MIME type for ``.cjs`` extension.
921-
(Contributed by John Franey in :gh:`140937`.)
922-
* Add ``application/toml``. (Contributed by Gil Forcada in :gh:`139959`.)
923-
* Add ``application/sql`` and ``application/vnd.sqlite3``.
924-
(Contributed by Charlie Lin in :gh:`145698`.)
925-
* Add the following MIME types:
926-
927-
- ``application/vnd.ms-cab-compressed`` for ``.cab`` extension
928-
- ``application/vnd.ms-htmlhelp`` for ``.chm`` extension
929-
- ``application/vnd.ms-officetheme`` for ``.thmx`` extension
930-
931-
(Contributed by Charlie Lin in :gh:`145718`.)
932-
933-
* Add ``image/jxl``. (Contributed by Foolbar in :gh:`144213`.)
917+
* Add more MIME types.
918+
(Contributed by Benedikt Johannes, Charlie Lin, Foolbar, Gil Forcada and
919+
John Franey
920+
in :gh:`144217`, :gh:`145720`, :gh:`140937`, :gh:`139959`, :gh:`145698`,
921+
:gh:`145718` and :gh:`144213`.)
934922
* Rename ``application/x-texinfo`` to ``application/texinfo``.
935923
(Contributed by Charlie Lin in :gh:`140165`.)
936924
* Changed the MIME type for ``.ai`` files to ``application/pdf``.
@@ -1114,7 +1102,7 @@ subprocess
11141102

11151103
If none of these mechanisms are available, the function falls back to the
11161104
traditional busy loop (non-blocking call and short sleeps).
1117-
(Contributed by Giampaolo Rodola in :gh:`83069`).
1105+
(Contributed by Giampaolo Rodola in :gh:`83069`.)
11181106

11191107

11201108
symtable
@@ -1171,7 +1159,7 @@ timeit
11711159

11721160
* Make the target time of :meth:`timeit.Timer.autorange` configurable
11731161
and add ``--target-time`` option to the command-line interface.
1174-
(Contributed by Alessandro Cucci and Miikka Koskinen in :gh:`140283`.)
1162+
(Contributed by Alessandro Cucci and Miikka Koskinen in :gh:`80642`.)
11751163

11761164

11771165
tkinter
@@ -1216,10 +1204,7 @@ tomllib
12161204
Previously an inline table had to be on a single line and couldn't end
12171205
with a trailing comma. This is now relaxed so that the following is valid:
12181206

1219-
.. syntax highlighting needs TOML 1.1.0 support in Pygments,
1220-
see https://github.com/pygments/pygments/issues/3026
1221-
1222-
.. code-block:: text
1207+
.. code-block:: toml
12231208
12241209
tbl = {
12251210
key = "a string",
@@ -1231,15 +1216,15 @@ tomllib
12311216
- Add ``\xHH`` notation to basic strings for codepoints under 255,
12321217
and the ``\e`` escape for the escape character:
12331218

1234-
.. code-block:: text
1219+
.. code-block:: toml
12351220
12361221
null = "null byte: \x00; letter a: \x61"
12371222
csi = "\e["
12381223
12391224
- Seconds in datetime and time values are now optional.
12401225
The following are now valid:
12411226

1242-
.. code-block:: text
1227+
.. code-block:: toml
12431228
12441229
dt = 2010-02-03 14:15
12451230
t = 14:15
@@ -1421,7 +1406,7 @@ Optimizations
14211406
=============
14221407

14231408
* ``mimalloc`` is now used as the default allocator for
1424-
for raw memory allocations such as via :c:func:`PyMem_RawMalloc`
1409+
raw memory allocations such as via :c:func:`PyMem_RawMalloc`
14251410
for better performance on :term:`free-threaded builds <free-threaded build>`.
14261411
(Contributed by Kumar Aditya in :gh:`144914`.)
14271412

@@ -1440,7 +1425,7 @@ base64 & binascii
14401425

14411426
* Implementation for Base32 has been rewritten in C.
14421427
Encoding and decoding is now two orders of magnitude faster.
1443-
(Contributed by James Seo in :gh:`146192`)
1428+
(Contributed by James Seo in :gh:`146192`.)
14441429

14451430

14461431
csv
@@ -1534,7 +1519,7 @@ The JIT compiler's machine code generator now produces better machine code
15341519
for x86-64 and AArch64 macOS and Linux targets. In general, users should
15351520
experience lower memory usage for generated machine code and more efficient
15361521
machine code versus 3.14.
1537-
(Contributed by Brandt Bucher in :gh:`136528` and :gh:`136528`.
1522+
(Contributed by Brandt Bucher in :gh:`136528` and :gh:`135905`.
15381523
Implementation for AArch64 contributed by Mark Shannon in :gh:`139855`.
15391524
Additional optimizations for AArch64 contributed by Mark Shannon and
15401525
Diego Russo in :gh:`140683` and :gh:`142305`.)
@@ -1557,6 +1542,14 @@ collections.abc
15571542
deprecated since Python 3.12, and is scheduled for removal in Python 3.17.
15581543

15591544

1545+
ctypes
1546+
------
1547+
1548+
* Removed the undocumented function :func:`!ctypes.SetPointerType`,
1549+
which has been deprecated since Python 3.13.
1550+
(Contributed by Bénédikt Tran in :gh:`133866`.)
1551+
1552+
15601553
datetime
15611554
--------
15621555

@@ -1566,14 +1559,6 @@ datetime
15661559
(Contributed by Stan Ulbrych and Gregory P. Smith in :gh:`70647`.)
15671560

15681561

1569-
ctypes
1570-
------
1571-
1572-
* Removed the undocumented function :func:`!ctypes.SetPointerType`,
1573-
which has been deprecated since Python 3.13.
1574-
(Contributed by Bénédikt Tran in :gh:`133866`.)
1575-
1576-
15771562
glob
15781563
----
15791564

@@ -1658,6 +1643,9 @@ typing
16581643
or ``TD = TypedDict("TD", {})`` instead.
16591644
(Contributed by Bénédikt Tran in :gh:`133823`.)
16601645

1646+
* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
1647+
(Contributed by Nikita Sobolev in :gh:`133601`.)
1648+
16611649

16621650
wave
16631651
----
@@ -1773,8 +1761,6 @@ New deprecations
17731761
:func:`issubclass`, but warnings were not previously emitted if it was
17741762
merely imported or accessed from the :mod:`!typing` module.
17751763

1776-
* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
1777-
(Contributed by Nikita Sobolev in :gh:`133601`.)
17781764

17791765
* ``__version__``
17801766

@@ -2061,8 +2047,8 @@ Deprecated C APIs
20612047

20622048
- :c:macro:`Py_ALIGNED`: Prefer ``alignas`` instead.
20632049
- :c:macro:`PY_FORMAT_SIZE_T`: Use ``"z"`` directly.
2064-
- :c:macro:`Py_LL` & :c:macro:`Py_ULL`:
2065-
Use standard suffixes, ``LL`` & ``ULL``.
2050+
- :c:macro:`Py_LL` and :c:macro:`Py_ULL`:
2051+
Use standard suffixes, ``LL`` and ``ULL``.
20662052
- :c:macro:`PY_LONG_LONG`, :c:macro:`PY_LLONG_MIN`, :c:macro:`PY_LLONG_MAX`,
20672053
:c:macro:`PY_ULLONG_MAX`, :c:macro:`PY_INT32_T`, :c:macro:`PY_UINT32_T`,
20682054
:c:macro:`PY_INT64_T`, :c:macro:`PY_UINT64_T`, :c:macro:`PY_SIZE_MAX`:

Include/internal/pycore_genobject.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
3333
PyAPI_FUNC(PyObject *)_PyCoro_GetAwaitableIter(PyObject *o);
3434
PyAPI_FUNC(PyObject *)_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *);
3535

36+
// Exported for external JIT support
37+
PyAPI_FUNC(PyObject *) _PyCoro_ComputeOrigin(int origin_depth, _PyInterpreterFrame *current_frame);
38+
3639
extern PyTypeObject _PyCoroWrapper_Type;
3740
extern PyTypeObject _PyAsyncGenWrappedValue_Type;
3841
extern PyTypeObject _PyAsyncGenAThrow_Type;

Include/internal/pycore_instruments.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ typedef struct _PyCoMonitoringData {
122122
extern int
123123
_Py_Instrumentation_GetLine(PyCodeObject *code, _PyCoLineInstrumentationData *line_data, int index);
124124

125+
static inline uint8_t
126+
_PyCode_GetOriginalOpcode(_PyCoLineInstrumentationData *line_data, int index)
127+
{
128+
return line_data->data[index*line_data->bytes_per_entry];
129+
}
130+
131+
// Exported for external JIT support
132+
PyAPI_FUNC(uint8_t) _PyCode_Deinstrument(uint8_t opcode);
133+
125134
#ifdef __cplusplus
126135
}
127136
#endif

0 commit comments

Comments
 (0)