Skip to content

Commit f279be8

Browse files
committed
Merge in the main branch
2 parents 47ff800 + d3b7b93 commit f279be8

File tree

86 files changed

+5266
-2211
lines changed

Some content is hidden

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

86 files changed

+5266
-2211
lines changed

.github/workflows/reusable-san.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
|| ''
6262
}}.txt handle_segv=0" >> "$GITHUB_ENV"
6363
else
64-
echo "UBSAN_OPTIONS=${SAN_LOG_OPTION}" >> "$GITHUB_ENV"
64+
echo "UBSAN_OPTIONS=${SAN_LOG_OPTION} halt_on_error=1 suppressions=${GITHUB_WORKSPACE}/Tools/ubsan/suppressions.txt" >> "$GITHUB_ENV"
6565
fi
6666
echo "CC=clang" >> "$GITHUB_ENV"
6767
echo "CXX=clang++" >> "$GITHUB_ENV"
@@ -75,18 +75,21 @@ jobs:
7575
${{
7676
inputs.sanitizer == 'TSan'
7777
&& '--with-thread-sanitizer'
78-
|| '--with-undefined-behavior-sanitizer'
78+
|| '--with-undefined-behavior-sanitizer --with-strict-overflow'
7979
}}
8080
--with-pydebug
8181
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
8282
- name: Build CPython
8383
run: make -j4
8484
- name: Display build info
8585
run: make pythoninfo
86+
# test_{capi,faulthandler} are skipped under UBSan because
87+
# they raise signals that UBSan with halt_on_error=1 intercepts.
8688
- name: Tests
8789
run: >-
8890
./python -m test
8991
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
92+
${{ inputs.sanitizer == 'UBSan' && '-x test_capi -x test_faulthandler' || '' }}
9093
-j4
9194
- name: Parallel tests
9295
if: >-

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: a27a2e47c7751b639d2b5badf0ef6ff11fee893f # frozen: v0.15.4
3+
rev: e05c5c0818279e5ac248ac9e954431ba58865e61 # frozen: v0.15.7
44
hooks:
55
- id: ruff-check
66
name: Run Ruff (lint) on Platforms/Apple/

Doc/c-api/unicode.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,10 @@ object.
18811881
On success, return ``0``.
18821882
On error, set an exception, leave the writer unchanged, and return ``-1``.
18831883
1884+
To write a :class:`str` subclass which overrides the :meth:`~object.__str__`
1885+
method, :c:func:`PyUnicode_FromObject` can be used to get the original
1886+
string.
1887+
18841888
.. c:function:: int PyUnicodeWriter_WriteRepr(PyUnicodeWriter *writer, PyObject *obj)
18851889
18861890
Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*.

Doc/library/asyncio-future.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ Future Object
196196
Otherwise, change the Future's state to *cancelled*,
197197
schedule the callbacks, and return ``True``.
198198

199+
The optional string argument *msg* is passed as the argument to the
200+
:exc:`CancelledError` exception raised when a cancelled Future
201+
is awaited.
202+
199203
.. versionchanged:: 3.9
200204
Added the *msg* parameter.
201205

Doc/library/glob.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ The :mod:`!glob` module defines the following functions:
8383
This function may return duplicate path names if *pathname*
8484
contains multiple "``**``" patterns and *recursive* is true.
8585

86+
.. note::
87+
Any :exc:`OSError` exceptions raised from scanning the filesystem are
88+
suppressed. This includes :exc:`PermissionError` when accessing
89+
directories without read permission.
90+
8691
.. versionchanged:: 3.5
8792
Support for recursive globs using "``**``".
8893

@@ -106,6 +111,11 @@ The :mod:`!glob` module defines the following functions:
106111
This function may return duplicate path names if *pathname*
107112
contains multiple "``**``" patterns and *recursive* is true.
108113

114+
.. note::
115+
Any :exc:`OSError` exceptions raised from scanning the filesystem are
116+
suppressed. This includes :exc:`PermissionError` when accessing
117+
directories without read permission.
118+
109119
.. versionchanged:: 3.5
110120
Support for recursive globs using "``**``".
111121

Doc/library/itertools.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ and :term:`generators <generator>` which incur interpreter overhead.
850850

851851
def running_mean(iterable):
852852
"Yield the average of all values seen so far."
853-
# running_mean([8.5, 9.5, 7.5, 6.5]) -> 8.5 9.0 8.5 8.0
853+
# running_mean([8.5, 9.5, 7.5, 6.5]) 8.5 9.0 8.5 8.0
854854
return map(truediv, accumulate(iterable), count(1))
855855

856856
def repeatfunc(function, times=None, *args):
@@ -932,10 +932,10 @@ and :term:`generators <generator>` which incur interpreter overhead.
932932
yield element
933933

934934
def unique(iterable, key=None, reverse=False):
935-
"Yield unique elements in sorted order. Supports unhashable inputs."
936-
# unique([[1, 2], [3, 4], [1, 2]]) → [1, 2] [3, 4]
937-
sequenced = sorted(iterable, key=key, reverse=reverse)
938-
return unique_justseen(sequenced, key=key)
935+
"Yield unique elements in sorted order. Supports unhashable inputs."
936+
# unique([[1, 2], [3, 4], [1, 2]]) → [1, 2] [3, 4]
937+
sequenced = sorted(iterable, key=key, reverse=reverse)
938+
return unique_justseen(sequenced, key=key)
939939

940940
def sliding_window(iterable, n):
941941
"Collect data into overlapping fixed-length chunks or blocks."

Doc/library/pathlib.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,11 @@ Reading directories
13511351
``False``, this method follows symlinks except when expanding "``**``"
13521352
wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks.
13531353

1354+
.. note::
1355+
Any :exc:`OSError` exceptions raised from scanning the filesystem are
1356+
suppressed. This includes :exc:`PermissionError` when accessing
1357+
directories without read permission.
1358+
13541359
.. audit-event:: pathlib.Path.glob self,pattern pathlib.Path.glob
13551360

13561361
.. versionchanged:: 3.12
@@ -1377,6 +1382,11 @@ Reading directories
13771382
The paths are returned in no particular order.
13781383
If you need a specific order, sort the results.
13791384

1385+
.. note::
1386+
Any :exc:`OSError` exceptions raised from scanning the filesystem are
1387+
suppressed. This includes :exc:`PermissionError` when accessing
1388+
directories without read permission.
1389+
13801390
.. seealso::
13811391
:ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation.
13821392

Doc/library/stdtypes.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,8 +2775,22 @@ expression support in the :mod:`re` module).
27752775
.. method:: str.swapcase()
27762776

27772777
Return a copy of the string with uppercase characters converted to lowercase and
2778-
vice versa. Note that it is not necessarily true that
2779-
``s.swapcase().swapcase() == s``.
2778+
vice versa. For example:
2779+
2780+
.. doctest::
2781+
2782+
>>> 'Hello World'.swapcase()
2783+
'hELLO wORLD'
2784+
2785+
Note that it is not necessarily true that ``s.swapcase().swapcase() == s``.
2786+
For example:
2787+
2788+
.. doctest::
2789+
2790+
>>> 'straße'.swapcase().swapcase()
2791+
'strasse'
2792+
2793+
See also :meth:`str.lower` and :meth:`str.upper`.
27802794

27812795

27822796
.. method:: str.title()

Doc/whatsnew/3.15.rst

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,17 @@ http.cookies
858858
(Contributed by Nick Burns and Senthil Kumaran in :gh:`92936`.)
859859

860860

861+
http.server
862+
-----------
863+
864+
* The logging of :mod:`~http.server.BaseHTTPRequestHandler`,
865+
as used by the :ref:`command-line interface <http-server-cli>`,
866+
is colored by default.
867+
This can be controlled with :ref:`environment variables
868+
<using-on-controlling-color>`.
869+
(Contributed by Hugo van Kemenade in :gh:`146292`.)
870+
871+
861872
inspect
862873
-------
863874

@@ -1133,6 +1144,10 @@ tarfile
11331144
timeit
11341145
------
11351146

1147+
* The output of the :mod:`timeit` command-line interface is colored by default.
1148+
This can be controlled with
1149+
:ref:`environment variables <using-on-controlling-color>`.
1150+
(Contributed by Hugo van Kemenade in :gh:`146609`.)
11361151
* The command-line interface now colorizes error tracebacks
11371152
by default. This can be controlled with
11381153
:ref:`environment variables <using-on-controlling-color>`.
@@ -1330,6 +1345,25 @@ warnings
13301345
(Contributed by Serhiy Storchaka in :gh:`135801`.)
13311346

13321347

1348+
wave
1349+
----
1350+
1351+
* Added support for IEEE floating-point WAVE audio
1352+
(``WAVE_FORMAT_IEEE_FLOAT``) in :mod:`wave`.
1353+
1354+
* Added :meth:`wave.Wave_read.getformat`, :meth:`wave.Wave_write.getformat`,
1355+
and :meth:`wave.Wave_write.setformat` for explicit frame format handling.
1356+
1357+
* :meth:`wave.Wave_write.setparams` accepts both 7-item tuples including
1358+
``format`` and 6-item tuples for backwards compatibility (defaulting to
1359+
``WAVE_FORMAT_PCM``).
1360+
1361+
* ``WAVE_FORMAT_IEEE_FLOAT`` output now includes a ``fact`` chunk,
1362+
as required for non-PCM WAVE formats.
1363+
1364+
(Contributed by Lionel Koenig and Michiel W. Beijen in :gh:`60729`.)
1365+
1366+
13331367
xml.parsers.expat
13341368
-----------------
13351369

@@ -1599,21 +1633,6 @@ typing
15991633
wave
16001634
----
16011635

1602-
* Added support for IEEE floating-point WAVE audio
1603-
(``WAVE_FORMAT_IEEE_FLOAT``) in :mod:`wave`.
1604-
1605-
* Added :meth:`wave.Wave_read.getformat`, :meth:`wave.Wave_write.getformat`,
1606-
and :meth:`wave.Wave_write.setformat` for explicit frame format handling.
1607-
1608-
* :meth:`wave.Wave_write.setparams` accepts both 7-item tuples including
1609-
``format`` and 6-item tuples for backwards compatibility (defaulting to
1610-
``WAVE_FORMAT_PCM``).
1611-
1612-
* ``WAVE_FORMAT_IEEE_FLOAT`` output now includes a ``fact`` chunk,
1613-
as required for non-PCM WAVE formats.
1614-
1615-
(Contributed by Lionel Koenig and Michiel W. Beijen in :gh:`60729`.)
1616-
16171636
* Removed the ``getmark()``, ``setmark()`` and ``getmarkers()`` methods
16181637
of the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes,
16191638
which were deprecated since Python 3.13.

Include/internal/pycore_instruments.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ PyAPI_FUNC(void)
6464
_Py_call_instrumentation_exc2(PyThreadState *tstate, int event,
6565
_PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg0, PyObject *arg1);
6666

67-
extern int
68-
_Py_Instrumentation_GetLine(PyCodeObject *code, int index);
69-
7067
PyAPI_DATA(PyObject) _PyInstrumentation_MISSING;
7168
PyAPI_DATA(PyObject) _PyInstrumentation_DISABLE;
7269

@@ -122,6 +119,8 @@ typedef struct _PyCoMonitoringData {
122119
uint8_t *per_instruction_tools;
123120
} _PyCoMonitoringData;
124121

122+
extern int
123+
_Py_Instrumentation_GetLine(PyCodeObject *code, _PyCoLineInstrumentationData *line_data, int index);
125124

126125
#ifdef __cplusplus
127126
}

0 commit comments

Comments
 (0)