8000 Merge branch 'main' into mix-tiers · python/cpython@b808f6d · GitHub
[go: up one dir, main page]

Skip to content

Commit b808f6d

Browse files
committed
Merge branch 'main' into mix-tiers
2 parents a720f1a + 102685c commit b808f6d

File tree

83 files changed

+2443
-1550
lines changed

Some content is hidden

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

83 files changed

+2443
-1550
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Doc/c-api/stable.rst @encukou
151151

152152
**/*idlelib* @terryjreedy
153153

154-
**/*typing* @gvanrossum @Fidget-Spinner @JelleZijlstra @AlexWaygood
154+
**/*typing* @gvanrossum @JelleZijlstra @AlexWaygood
155155

156156
**/*ftplib @giampaolo
157157
**/*shutil @giampaolo

.github/workflows/build.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,29 +182,29 @@ jobs:
182182
name: 'Windows'
183183
needs: check_source
184184
if: needs.check_source.outputs.run_tests == 'true'
185-
uses: ./.github/workflows/reusable-build-windows.yml
185+
uses: ./.github/workflows/reusable-windows.yml
186186

187187
build_windows_free_threaded:
188188
name: 'Windows (free-threaded)'
189189
needs: check_source
190190
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
191-
uses: ./.github/workflows/reusable-build-windows.yml
191+
uses: ./.github/workflows/reusable-windows.yml
192192
with:
193193
free-threaded: true
194194

195195
build_macos:
196196
name: 'macOS'
197197
needs: check_source
198198
if: needs.check_source.outputs.run_tests == 'true'
199-
uses: ./.github/workflows/reusable-build-macos.yml
199+
uses: ./.github/workflows/reusable-macos.yml
200200
with:
201201
config_hash: ${{ needs.check_source.outputs.config_hash }}
202202

203203
build_macos_free_threaded:
204204
name: 'macOS (free-threaded)'
205205
needs: check_source
206206
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
207-
uses: ./.github/workflows/reusable-build-macos.yml
207+
uses: ./.github/workflows/reusable-macos.yml
208208
with:
209209
config_hash: ${{ needs.check_source.outputs.config_hash }}
210210
free-threaded: true
@@ -213,7 +213,7 @@ jobs:
213213
name: 'Ubuntu'
214214
needs: check_source
215215
if: needs.check_source.outputs.run_tests == 'true'
216-
uses: ./.github/workflows/reusable-build-ubuntu.yml
216+
uses: ./.github/workflows/reusable-ubuntu.yml
217217
with:
218218
config_hash: ${{ needs.check_source.outputs.config_hash }}
219219
options: |
@@ -226,7 +226,7 @@ jobs:
226226
name: 'Ubuntu (free-threaded)'
227227
needs: check_source
228228
if: needs.check_source.outputs.run_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'topic-free-threaded')
229-
uses: ./.github/workflows/reusable-build-ubuntu.yml
229+
uses: ./.github/workflows/reusable-ubuntu.yml
230230
with:
231231
config_hash: ${{ needs.check_source.outputs.config_hash }}
232232
options: |
@@ -500,11 +500,13 @@ jobs:
500500
- check_source # Transitive dependency, needed to access `run_tests` value
501501
- check-docs
502502
- check_generated_files
503-
- build_windows
504503
- build_macos
504+
- build_macos_free_threaded
505505
- build_ubuntu
506506
- build_ubuntu_free_threaded
507507
- build_ubuntu_ssltests
508+
- build_windows
509+
- build_windows_free_threaded
508510
- test_hypothesis
509511
- build_asan
510512
- cifuzz
@@ -517,10 +519,10 @@ jobs:
517519
with:
518520
allowed-failures: >-
519521
build_macos,
522+
build_macos_free_threaded,
520523
build_ubuntu_free_threaded,
521524
build_ubuntu_ssltests,
522-
build_win32,
523-
build_win_arm64,
525+
build_windows_free_threaded,
524526
cifuzz,
525527
test_hypothesis,
526528
allowed-skips: >-
@@ -535,13 +537,13 @@ jobs:
535537
needs.check_source.outputs.run_tests != 'true'
536538
&& '
537539
check_generated_files,
538-
build_win32,
539-
build_win_amd64,
540-
build_win_arm64,
541540
build_macos,
541+
build_macos_free_threaded,
542542
build_ubuntu,
543543
build_ubuntu_free_threaded,
544544
build_ubuntu_ssltests,
545+
build_windows,
546+
build_windows_free_threaded,
545547
build_asan,
546548
'
547549
|| ''

Doc/c-api/exceptions.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,26 @@ Printing and clearing
9999
Use :func:`sys.unraisablehook`.
100100
101101
102+
.. c:function:: void PyErr_FormatUnraisable(const char *format, ...)
103+
104+
Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent
105+
parameters help format the warning message; they have the same meaning and
106+
values as in :c:func:`PyUnicode_FromFormat`.
107+
``PyErr_WriteUnraisable(obj)`` is roughtly equivalent to
108+
``PyErr_FormatUnraisable("Exception ignored in: %R, obj)``.
109+
If *format* is ``NULL``, only the traceback is printed.
110+
111+
.. versionadded:: 3.13
112+
113+
102114
.. c:function:: void PyErr_DisplayException(PyObject *exc)
103115
104116
Print the standard traceback display of ``exc`` to ``sys.stderr``, including
105117
chained exceptions and notes.
106118
107119
.. versionadded:: 3.12
108120
121+
109122
Raising exceptions
110123
==================
111124

Doc/library/fcntl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a
1818
complete description of these calls, see :manpage:`fcntl(2)` and
1919
:manpage:`ioctl(2)` Unix manual pages.
2020

21-
.. include:: ../includes/wasm-notavail.rst
21+
.. availability:: Unix, not Emscripten, not WASI.
2222

2323
All functions in this module take a file descriptor *fd* as their first
2424
argument. This can be an integer file descriptor, such as returned by

Doc/library/grp.rst

L 10000 ines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
This module provides access to the Unix group database. It is available on all
1111
Unix versions.
1212

13-
.. include:: ../includes/wasm-notavail.rst
13+
.. availability:: Unix, not Emscripten, not WASI.
1414

1515
Group database entries are reported as a tuple-like object, whose attributes
1616
correspond to the members of the ``group`` structure (Attribute field below, see

Doc/library/posix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ This module provides access to operating system functionality that is
1111
standardized by the C Standard and the POSIX standard (a thinly disguised Unix
1212
interface).
1313

14+
.. availability:: Unix.
15+
1416
.. index:: pair: module; os
1517

1618
**Do not import this module directly.** Instead, import the module :mod:`os`,

Doc/library/pty.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ The :mod:`pty` module defines operations for handling the pseudo-terminal
1616
concept: starting another process and being able to write to and read from its
1717
controlling terminal programmatically.
1818

19+
.. availability:: Unix.
20+
1921
Pseudo-terminal handling is highly platform dependent. This code is mainly
2022
tested on Linux, FreeBSD, and macOS (it is supposed to work on other POSIX
2123
platforms but it's not been thoroughly tested).

Doc/library/pwd.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
This module provides access to the Unix user account and password database. It
1111
is available on all Unix versions.
1212

13-
.. include:: ../includes/wasm-notavail.rst
13+
.. availability:: Unix, not Emscripten, not WASI.
1414

1515
Password database entries are reported as a tuple-like object, whose attributes
1616
correspond to the members of the ``passwd`` structure (Attribute field below,

Doc/library/resource.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
This module provides basic mechanisms for measuring and controlling system
1414
resources utilized by a program.
1515

16-
.. include:: ../includes/wasm-notavail.rst
16+
.. availability:: Unix, not Emscripten, not WASI.
1717

1818
Symbolic constants are used to specify particular system resources and to
1919
request usage information about either the current process or its children.

Doc/library/sys.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ always available.
175175

176176
Call ``func(*args)``, while tracing is enabled. The tracing state is saved,
177177
and restored afterwards. This is intended to be called from a debugger from
178-
a checkpoint, to recursively debug some other code.
178+
a checkpoint, to recursively debug or profile some other code.
179+
180+
Tracing is suspended while calling a tracing function set by
181+
:func:`settrace` or :func:`setprofile` to avoid infinite recursion.
182+
:func:`!call_tracing` enables explicit recursion of the tracing function.
179183

180184

181185
.. data:: copyright
@@ -1473,13 +1477,16 @@ always available.
14731477
its return value is not used, so it can simply return ``None``. Error in the profile
14741478
function will cause itself unset.
14751479

1480+
.. note::
1481+
The same tracing mechanism is used for :func:`!setprofile` as :func:`settrace`.
1482+
To trace calls with :func:`!setprofile` inside a tracing function
1483+
(e.g. in a debugger breakpoint), see :func:`call_tracing`.
1484+
14761485
Profile functions should have three arguments: *frame*, *event*, and
14771486
*arg*. *frame* is the current stack frame. *event* is a string: ``'call'``,
14781487
``'return'``, ``'c_call'``, ``'c_return'``, or ``'c_exception'``. *arg* depends
14791488
on the event type.
14801489

1481-
.. audit-event:: sys.setprofile "" sys.setprofile
1482-
14831490
The events have the following meaning:
14841491

14851492
``'call'``
@@ -1501,6 +1508,9 @@ always available.
15011508
``'c_exception'``
15021509
A C function has raised an exception. *arg* is the C function object.
15031510

1511+
.. audit-event:: sys.setprofile "" sys.setprofile
1512+
1513+
15041514
.. function:: setrecursionlimit(limit)
15051515

15061516
Set the maximum depth of the Python interpreter stack to *limit*. This limit
@@ -1560,6 +1570,10 @@ always available.
15601570
If there is any error occurred in the trace function, it will be unset, just
15611571
like ``settrace(None)`` is called.
15621572

1573+
.. note::
1574+
Tracing is disabled while calling the trace function (e.g. a function set by
1575+
:func:`!settrace`). For recursive tracing see :func:`call_tracing`.
1576+
15631577
The events have the following meaning:
15641578

15651579
``'call'``

Doc/library/syslog.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ This module provides an interface to the Unix ``syslog`` library routines.
1111
Refer to the Unix manual pages for a detailed description of the ``syslog``
1212
facility.
1313

14+
.. availability:: Unix, not Emscripten, not WASI.
15+
1416
This module wraps the system ``syslog`` family of routines. A pure Python
1517
library that can speak to a syslog server is available in the
1618
:mod:`logging.handlers` module as :class:`SysLogHandler`.
1719

18-
.. include:: ../includes/wasm-notavail.rst
19-
2020
The module defines the following functions:
2121

2222

Doc/library/tempfile.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,13 @@ Here are some examples of typical usage of the :mod:`tempfile` module::
404404

405405
# create a temporary file using a context manager
406406
# close the file, use the name to open the file again
407-
>>> with tempfile.TemporaryFile(delete_on_close=False) as fp:
408-
... fp.write(b'Hello world!')
409-
... fp.close()
410-
# the file is closed, but not removed
411-
# open the file again by using its name
412-
... with open(fp.name) as f
413-
... f.read()
407+
>>> with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:
408+
... fp.write(b'Hello world!')
409+
... fp.close()
410+
... # the file is closed, but not removed
411+
... # open the file again by using its name
412+
... with open(fp.name, mode='rb') as f:
413+
... f.read()
414414
b'Hello world!'
415415
>>>
416416
# file is now removed

Doc/library/termios.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ complete description of these calls, see :manpage:`termios(3)` Unix manual
1616
page. It is only available for those Unix versions that support POSIX
1717
*termios* style tty I/O control configured during installation.
1818

19+
.. availability:: Unix.
20+
1921
All functions in this module take a file descriptor *fd* as their first
2022
argument. This can be an integer file descriptor, such as returned by
2123
``sys.stdin.fileno()``, or a :term:`file object`, such as ``sys.stdin`` itself.

Doc/library/tty.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
The :mod:`tty` module defines functions for putting the tty into cbreak and raw
1616
modes.
1717

18+
.. availability:: Unix.
19+
1820
Because it requires the :mod:`termios` module, it will work only on Unix.
1921

2022
The :mod:`tty` module defines the following functions:

Doc/library/unittest.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,14 @@ Test cases
15711571

15721572
.. versionadded:: 3.8
15731573

1574+
.. attribute:: loop_factory
1575+
1576+
The *loop_factory* passed to :class:`asyncio.Runner`. Override
1577+
in subclasses with :class:`asyncio.EventLoop` to avoid using the
1578+
asyncio policy system.
1579+
1580+
.. versionadded:: 3.13
1581+
15741582
.. coroutinemethod:: asyncSetUp()
15751583

15761584
Method called to prepare the test fixture. This is called after :meth:`setUp`.

Doc/library/xml.etree.elementtree.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,9 @@ Functions
622622
*parser* is an optional parser instance. If not given, the standard
623623
:class:`XMLParser` parser is used. *parser* must be a subclass of
624624
:class:`XMLParser` and can only use the default :class:`TreeBuilder` as a
625-
target. Returns an :term:`iterator` providing ``(event, elem)`` pairs.
625+
target. Returns an :term:`iterator` providing ``(event, elem)`` pairs;
626+
it has a ``root`` attribute that references the root element of the
627+
resulting XML tree once *source* is fully read.
626628

627629
Note that while :func:`iterparse` builds the tree incrementally, it issues
628630
blocking reads on *source* (or the file it names). As such, it's unsuitable

Doc/whatsnew/3.12.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ importlib.resources
716716
* :func:`importlib.resources.as_file` now supports resource directories.
717717
(Contributed by Jason R. Coombs in :gh:`97930`.)
718718

719+
* Rename first parameter of :func:`importlib.resources.files` to *anchor*.
720+
(Contributed by Jason R. Coombs in :gh:`100598`.)
721+
719722
inspect
720723
-------
721724

0 commit comments

Comments
 (0)
0