8000 Catch up with main · python/cpython@c4bf874 · GitHub
[go: up one dir, main page]

Skip to content

Commit c4bf874

Browse files
committed
Catch up with main
2 parents 5f4e950 + f4b5588 commit c4bf874

File tree

219 files changed

+7283
-4472
lines changed

Some content is hidden

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

219 files changed

+7283
-4472
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-
10000 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
|| ''

.github/workflows/new-bugs-announce-notifier.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
runs-on: ubuntu-latest
1414
timeout-minutes: 10
1515
steps:
16-
- uses: actions/setup-node@v3
16+
- uses: actions/setup-node@v4
1717
with:
18-
node-version: 14
18+
node-version: 20
1919
- run: npm install mailgun.js form-data
2020
- name: Send notification
2121
uses: actions/github-script@v6

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/howto/enum.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ Dataclass support
483483
When inheriting from a :class:`~dataclasses.dataclass`,
484484
the :meth:`~Enum.__repr__` omits the inherited class' name. For example::
485485

486+
>>> from dataclasses import dataclass, field
486487
>>> @dataclass
487488
... class CreatureDataMixin:
488489
... size: str
@@ -527,7 +528,8 @@ It is possible to modify how enum members are pickled/unpickled by defining
527528
:meth:`__reduce_ex__` in the enumeration class. The default method is by-value,
528529
but enums with complicated values may want to use by-name::
529530

530-
>>> class MyEnum(Enum):
531+
>>> import enum
532+
>>> class MyEnum(enum.Enum):
531533
... __reduce_ex__ = enum.pickle_by_enum_name
532534

533535
.. note::
@@ -770,7 +772,7 @@ be combined with them (but may lose :class:`IntFlag` membership::
770772
>>> Perm.X | 4
771773
<Perm.R|X: 5>
772774

773-
>>> Perm.X | 8
775+
>>> Perm.X + 8
774776
9
775777

776778
.. note::
@@ -1435,8 +1437,9 @@ alias::
14351437
... GRENE = 2
14361438
...
14371439
Traceback (most recent call last):
1438-
...
1440+
...
14391441
ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'
1442+
Error calling __set_name__ on '_proto_member' instance 'GRENE' in 'Color'
14401443

14411444
.. note::
14421445

Doc/library/dis.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,8 @@ iterations of the loop.
823823
.. versionchanged:: 3.12
824824
oparg set to be the exception block depth, for efficient closing of generators.
825825

826+
.. versionchanged:: 3.13
827+
this opcode no longer has an oparg
826828

827829
.. opcode:: SETUP_ANNOTATIONS
828830

@@ -1625,20 +1627,27 @@ iterations of the loop.
16251627
success (``True``) or failure (``False``).
16261628

16271629

1628-
.. opcode:: RESUME (where)
1630+
.. opcode:: RESUME (context)
16291631

16301632
A no-op. Performs internal tracing, debugging and optimization checks.
16311633

1632-
The ``where`` operand marks where the ``RESUME`` occurs:
1634+
The ``context`` oparand consists of two parts. The lowest two bits
1635+
indicate where the ``RESUME`` occurs:
16331636

16341637
* ``0`` The start of a function, which is neither a generator, coroutine
16351638
nor an async generator
16361639
* ``1`` After a ``yield`` expression
16371640
* ``2`` After a ``yield from`` expression
16381641
* ``3`` After an ``await`` expression
16391642

1643+
The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0``
1644+
otherwise.
1645+
16401646
.. versionadded:: 3.11
16411647

1648+
.. versionchanged:: 3.13
1649+
The oparg value changed to include information about except-depth
1650+
16421651

16431652
.. opcode:: RETURN_GENERATOR
16441653

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

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 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 :f 10000 unc:`!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.

0 commit comments

Comments
 (0)
0