Skip to content

Commit 97e2bdd

Browse files
committed
Merge remote-tracking branch 'upstream/main' into 3.15-whatsnew
2 parents e9cace5 + 7cea70e commit 97e2bdd

52 files changed

Lines changed: 920 additions & 215 deletions

Some content is hidden

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

.github/workflows/mypy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ jobs:
7171
persist-credentials: false
7272
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
7373
with:
74-
python-version: "3.13"
74+
python-version: "3.15"
75+
allow-prereleases: true
7576
cache: pip
7677
cache-dependency-path: Tools/requirements-dev.txt
7778
- run: pip install -r Tools/requirements-dev.txt

.readthedocs.yml

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,47 @@ build:
1212
tools:
1313
python: "3"
1414

15-
commands:
16-
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
17-
#
18-
# Cancel building pull requests when there aren't changes in the Doc directory.
19-
#
20-
# If there are no changes (git diff exits with 0) we force the command to return with 183.
21-
# This is a special exit code on Read the Docs that will cancel the build immediately.
22-
- |
23-
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ];
24-
then
25-
echo "No changes to Doc/ - exiting the build.";
26-
exit 183;
27-
fi
28-
29-
- asdf plugin add uv
30-
- asdf install uv latest
31-
- asdf global uv latest
32-
- make -C Doc venv html
33-
- mkdir _readthedocs
34-
- mv Doc/build/html _readthedocs/html
15+
jobs:
16+
post_checkout:
17+
# https://docs.readthedocs.com/platform/stable/guides/build/skip-build.html#skip-builds-based-on-conditions
18+
#
19+
# Cancel building pull requests when there aren't changes in the Doc
20+
# directory or RTD configuration, or if we can't cleanly merge the base
21+
# branch.
22+
- |
23+
set -eEux;
24+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ];
25+
then
26+
base_branch=main;
27+
git fetch --depth=50 origin $base_branch:origin-$base_branch;
28+
for attempt in $(seq 10);
29+
do
30+
if ! git merge-base HEAD origin-$base_branch;
31+
then
32+
git fetch --deepen=50 origin $base_branch;
33+
else
34+
break;
35+
fi;
36+
done;
37+
if ! git -c "user.name=rtd" -c "user.email=no-reply@readthedocs.org" merge --no-stat --no-edit origin-$base_branch;
38+
then
39+
echo "Unsuccessful merge with '$base_branch' branch, skipping the build";
40+
exit 183;
41+
fi;
42+
if git diff --exit-code --stat origin-$base_branch -- Doc/ .readthedocs.yml;
43+
then
44+
echo "No changes to Doc/ - skipping the build.";
45+
exit 183;
46+
fi;
47+
fi;
48+
create_environment:
49+
- echo "Skipping default environment creation"
50+
install:
51+
- asdf plugin add uv
52+
- asdf install uv latest
53+
- asdf global uv latest
54+
build:
55+
html:
56+
- make -C Doc venv html
57+
- mkdir -p "$READTHEDOCS_OUTPUT"
58+
- mv Doc/build/html "$READTHEDOCS_OUTPUT/"

Doc/c-api/exceptions.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,3 +1348,67 @@ Tracebacks
13481348
13491349
This function returns ``0`` on success, and returns ``-1`` with an
13501350
exception set on failure.
1351+
1352+
.. c:function:: const char* PyUnstable_DumpTraceback(int fd, PyThreadState *tstate)
1353+
1354+
Write a trace of the Python stack in *tstate* into the file *fd*. The format
1355+
looks like::
1356+
1357+
Traceback (most recent call first):
1358+
File "xxx", line xxx in <xxx>
1359+
File "xxx", line xxx in <xxx>
1360+
...
1361+
File "xxx", line xxx in <xxx>
1362+
1363+
This function is meant to debug situations such as segfaults, fatal errors,
1364+
and similar. The file and function names it outputs are encoded to ASCII with
1365+
backslashreplace and truncated to 500 characters. It writes only the first
1366+
100 frames; further frames are truncated with the line ``...``.
1367+
1368+
This function will return ``NULL`` on success, or an error message on error.
1369+
1370+
This function is intended for use in crash scenarios such as signal handlers
1371+
for SIGSEGV, where the interpreter may be in an inconsistent state. Given
1372+
that it reads interpreter data structures that may be partially modified, the
1373+
function might produce incomplete output or it may even crash itself.
1374+
1375+
The caller does not need to hold an :term:`attached thread state`, nor does
1376+
*tstate* need to be attached.
1377+
1378+
.. versionadded:: next
1379+
1380+
.. c:function:: const char* PyUnstable_DumpTracebackThreads(int fd, PyInterpreterState *interp, PyThreadState *current_tstate, Py_ssize_t max_threads)
1381+
1382+
Write the traces of all Python threads in *interp* into the file *fd*.
1383+
1384+
If *interp* is ``NULL`` then this function will try to identify the current
1385+
interpreter using thread-specific storage. If it cannot, it will return an
1386+
error.
1387+
1388+
If *current_tstate* is not ``NULL`` then it will be used to identify what the
1389+
current thread is in the written output. If it is ``NULL`` then this function
1390+
will identify the current thread using thread-specific storage. It is not an
1391+
error if the function is unable to get the current Python thread state.
1392+
1393+
This function will return ``NULL`` on success, or an error message on error.
1394+
1395+
This function is meant to debug debug situations such as segfaults, fatal
1396+
errors, and similar. It calls :c:func:`PyUnstable_DumpTraceback` for each
1397+
thread. It only writes the tracebacks of the first *max_threads* threads,
1398+
further output is truncated with the line ``...``. If *max_threads* is 0, the
1399+
function will use a default value of 100 for the argument.
1400+
1401+
This function is intended for use in crash scenarios such as signal handlers
1402+
for SIGSEGV, where the interpreter may be in an inconsistent state. Given
1403+
that it reads interpreter data structures that may be partially modified, the
1404+
function might produce incomplete output or it may even crash itself.
1405+
1406+
The caller does not need to hold an :term:`attached thread state`, nor does
1407+
*current_tstate* need to be attached.
1408+
1409+
.. warning::
1410+
On the :term:`free-threaded build`, this function is not thread-safe. If
1411+
another thread deletes its :term:`thread state` while this function is being
1412+
called, the process will likely crash.
1413+
1414+
.. versionadded:: next

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ Pending removal in Python 3.17
3737
is deprecated and scheduled for removal in Python 3.17.
3838
(Contributed by Stan Ulbrych in :gh:`136702`.)
3939

40+
* :mod:`webbrowser`:
41+
42+
- :class:`!webbrowser.MacOSXOSAScript` is deprecated in favour of
43+
:class:`!webbrowser.MacOS`. (:gh:`137586`)
44+
4045
* :mod:`typing`:
4146

4247
- Before Python 3.14, old-style unions were implemented using the private class

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,12 @@ Pending removal in Python 3.19
3131
* :meth:`http.cookies.BaseCookie.js_output` is deprecated and will be
3232
removed in Python 3.19.
3333

34+
* :mod:`imaplib`:
35+
36+
* Altering :attr:`IMAP4.file <imaplib.IMAP4.file>` is now deprecated
37+
and slated for removal in Python 3.19. This property is now unused
38+
and changing its value does not automatically close the current file.
39+
40+
Before Python 3.14, this property was used to implement the corresponding
41+
``read()`` and ``readline()`` methods for :class:`~imaplib.IMAP4` but this
42+
is no longer the case since then.

Doc/howto/perf_profiling.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ How to obtain the best results
218218
------------------------------
219219

220220
For best results, keep frame pointers enabled. On supported GCC-compatible
221-
toolchains, CPython builds itself with ``-fno-omit-frame-pointer`` and, when
222-
available, ``-mno-omit-leaf-frame-pointer`` by default. These flags allow
221+
toolchains, CPython builds itself with ``-fno-omit-frame-pointer`` and similar
222+
flags (see :option:`--without-frame-pointers` for details). These flags allow
223223
profilers to unwind using only the frame pointer and not on DWARF debug
224224
information. This is because as the code that is interposed to allow ``perf``
225225
support is dynamically generated it doesn't have any DWARF debugging information

Doc/library/imaplib.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,16 @@ The following attributes are defined on instances of :class:`IMAP4`:
695695
.. versionadded:: 3.5
696696

697697

698+
.. property:: IMAP4.file
699+
700+
Internal :class:`~io.BufferedReader` associated with the underlying socket.
701+
This property is documented for legacy purposes but not part of the public
702+
interface. The caller is responsible to ensure that the current file is
703+
closed before changing it.
704+
705+
.. deprecated-removed:: next 3.19
706+
707+
698708
.. _imap4-example:
699709

700710
IMAP4 Example

Doc/library/webbrowser.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,15 @@ for the controller classes, all defined in this module.
172172
+------------------------+-----------------------------------------+-------+
173173
| ``'windows-default'`` | ``WindowsDefault`` | \(2) |
174174
+------------------------+-----------------------------------------+-------+
175-
| ``'macosx'`` | ``MacOSXOSAScript('default')`` | \(3) |
175+
| ``'macos'`` | ``MacOS('default')`` | \(3) |
176176
+------------------------+-----------------------------------------+-------+
177-
| ``'safari'`` | ``MacOSXOSAScript('safari')`` | \(3) |
177+
| ``'safari'`` | ``MacOS('safari')`` | \(3) |
178178
+------------------------+-----------------------------------------+-------+
179-
| ``'google-chrome'`` | ``Chrome('google-chrome')`` | |
179+
| ``'chrome'`` | ``MacOS('google chrome')`` | \(3) |
180+
+------------------------+-----------------------------------------+-------+
181+
| ``'firefox'`` | ``MacOS('firefox')`` | \(3) |
180182
+------------------------+-----------------------------------------+-------+
181-
| ``'chrome'`` | ``Chrome('chrome')`` | |
183+
| ``'google-chrome'`` | ``Chrome('google-chrome')`` | |
182184
+------------------------+-----------------------------------------+-------+
183185
| ``'chromium'`` | ``Chromium('chromium')`` | |
184186
+------------------------+-----------------------------------------+-------+
@@ -221,6 +223,17 @@ Notes:
221223
.. versionchanged:: 3.13
222224
Support for iOS has been added.
223225

226+
.. versionadded:: next
227+
:class:`!MacOS` has been added as a replacement for :class:`!MacOSXOSAScript`,
228+
opening browsers via :program:`/usr/bin/open` instead of :program:`osascript`.
229+
230+
.. deprecated-removed:: next 3.17
231+
:class:`!MacOSXOSAScript` is deprecated in favour of :class:`!MacOS`.
232+
Using :program:`/usr/bin/open` instead of :program:`osascript` is a
233+
security and usability improvement: :program:`osascript` may be blocked
234+
on managed systems due to its abuse potential as a general-purpose
235+
scripting interpreter.
236+
224237
Here are some simple examples::
225238

226239
url = 'https://docs.python.org/'

Doc/library/xml.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,19 @@ This module also defines utility functions.
5454
"!", "?", and "=" are forbidden.
5555
The name cannot start with a digit or a character like "-", ".", and "·".
5656

57-
..versionadded:: next
57+
.. versionadded:: next
58+
59+
60+
.. function:: is_valid_text(data)
61+
62+
Return ``True`` if the string is a sequence of legal XML 1.0 characters,
63+
``False`` otherwise.
64+
65+
Almost all characters are permitted in XML 1.0 documents, except C0 control
66+
characters (excluding TAB, CR and LF), surrogate characters and special
67+
Unicode characters U+FFFE and U+FFFF.
68+
69+
.. versionadded:: next
5870

5971

6072
.. _xml-security:

Doc/using/configure.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -784,11 +784,19 @@ also be used to improve performance.
784784

785785
Disable frame pointers, which are enabled by default (see :pep:`831`).
786786

787-
By default, the build appends ``-fno-omit-frame-pointer`` (and
788-
``-mno-omit-leaf-frame-pointer`` when the compiler supports it) to
789-
``BASECFLAGS`` so profilers, debuggers, and system tracing tools
790-
(``perf``, ``eBPF``, ``dtrace``, ``gdb``) can walk the C call stack
791-
without DWARF metadata. The flags propagate to third-party C
787+
By default, the build appends flags to generate frame or backchain
788+
pointers to ``BASECFLAGS``:
789+
790+
- ``-fno-omit-frame-pointer`` and/or ``-mno-omit-leaf-frame-pointer``
791+
are added when the compiler supports them.
792+
- ``-marm`` is added on 32-bit ARM when supported,
793+
- on s390x platforms, when supported, ``-mbackchain`` is added *instead*.
794+
of the above frame pointer flags.
795+
796+
Frame pointers enable profilers, debuggers, and system tracing tools
797+
(``perf``, ``eBPF``, ``dtrace``, ``gdb``) to walk the C call stack
798+
without DWARF metadata.
799+
The flags propagate to third-party C
792800
extensions through :mod:`sysconfig`. On compilers that do not
793801
understand them, the build silently skips them.
794802

0 commit comments

Comments
 (0)