8000 Merge · python/cpython@059bd20 · GitHub
[go: up one dir, main page]

Skip to content

Commit 059bd20

Browse files
committed
Merge
2 parents 95f1898 + ac01e22 commit 059bd20

File tree

289 files changed

+6086
-3197
lines changed

Some content is hidden

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

289 files changed

+6086
-3197
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 7 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: |
@@ -518,7 +518,6 @@ jobs:
518518
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
519 10000 519
with:
520520
allowed-failures: >-
521-
build_macos,
522521
build_macos_free_threaded,
523522
build_ubuntu_free_threaded,
524523
build_ubuntu_ssltests,

.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/bytes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ called with a non-bytes parameter.
155155
156156
Return the null-terminated contents of the object *obj*
157157
through the output variables *buffer* and *length*.
158+
Returns ``0`` on success.
158159
159160
If *length* is ``NULL``, the bytes object
160161
may not contain embedded null bytes;

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/difflib.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,12 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
171171
expressed in the ISO 8601 format. If not specified, the
172172
strings default to blanks.
173173

174+
>>> import sys
175+
>>> from difflib import *
174176
>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
175177
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
176-
>>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py', tofile='after.py'))
178+
>>> sys.stdout.writelines(context_diff(s1, s2, fromfile='before.py',
179+
... tofile='after.py'))
177180
*** before.py
178181
--- after.py
179182
***************
@@ -294,13 +297,12 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
294297
For inputs that do not have trailing newlines, set the *lineterm* argument to
295298
``""`` so that the output will be uniformly newline free.
296299

297-
The context diff format normally has a header for filenames and modification
300+
The unified diff format normally has a header for filenames and modification
298301
times. Any or all of these may be specified using strings for *fromfile*,
299302
*tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally
300303
expressed in the ISO 8601 format. If not specified, the
301304
strings default to blanks.
302305

303-
304306
>>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n']
305307
>>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n']
306308
>>> sys.stdout.writelines(unified_diff(s1, s2, fromfile='before.py', tofile='after.py'))

Doc/library/dis.rst

Lines changed: 12 additions & 2 deletions
D7AE
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,9 @@ 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+
oparg is ``1`` if this instruction is part of a yield-from or await, and ``0``
828+
otherwise.
826829

827830
.. opcode:: SETUP_ANNOTATIONS
828831

@@ -1625,20 +1628,27 @@ iterations of the loop.
16251628
success (``True``) or failure (``False``).
16261629

16271630

1628-
.. opcode:: RESUME (where)
1631+
.. opcode:: RESUME (context)
16291632

16301633
A no-op. Performs internal tracing, debugging and optimization checks.
16311634

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

16341638
* ``0`` The start of a function, which is neither a generator, coroutine
16351639
nor an async generator
16361640
* ``1`` After a ``yield`` expression
16371641
* ``2`` After a ``yield from`` expression
16381642
* ``3`` After an ``await`` expression
16391643

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

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

16431653
.. opcode:: RETURN_GENERATOR
16441654

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/logging.handlers.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,7 @@ supports sending logging messages to a remote or local Unix syslog.
656656
to the other end. This method is called during handler initialization,
657657
but it's not regarded as an error if the other end isn't listening at
658658
this point - the method will be called again when emitting an event, if
659-
but it's not regarded as an error if the other end isn't listening yet
660-
--- the method will be called again when emitting an event,
661-
if there is no socket at that point.
659+
there is no socket at that point.
662660

663661
.. versionadded:: 3.11
664662

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.

0 commit comments

Comments
 (0)
0