Skip to content

Commit ae6d786

Browse files
committed
Merge in the main branch
2 parents c162d64 + 9d05428 commit ae6d786

283 files changed

Lines changed: 4337 additions & 1902 deletions

File tree

Some content is hidden

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

‎.github/CODEOWNERS‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,12 @@ Lib/_osx_support.py @python/macos-team
172172
Lib/test/test__osx_support.py @python/macos-team
173173

174174
# WebAssembly (Emscripten)
175-
Platforms/emscripten @freakboy3742 @emmatyping
176-
Tools/wasm/emscripten @freakboy3742 @emmatyping
175+
Platforms/emscripten @freakboy3742 @emmatyping @hoodmane
176+
Tools/wasm/emscripten @freakboy3742 @emmatyping @hoodmane
177+
Python/wasm_trampoline.c @hoodmane
178+
Python/emscripten_signal.c @hoodmane
179+
Python/emscripten_syscalls.c @hoodmane
180+
.github/workflows/reusable-emscripten.yml @hoodmane
177181

178182
# WebAssembly (WASI)
179183
Platforms/WASI @brettcannon @emmatyping @savannahostrowski

‎.github/workflows/reusable-wasi.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,4 @@ jobs:
6464
- name: "Display build info of the host/WASI Python"
6565
run: python3 Platforms/WASI pythoninfo-host
6666
- name: "Test"
67-
run: |
68-
CROSS_BUILD_WASI=$(python3 Platforms/WASI path)
69-
make --directory "${CROSS_BUILD_WASI}" test
67+
run: python3 Platforms/WASI test

‎Doc/builtins/functions.rst‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ are always available. They are listed here in alphabetical order.
740740
This function supports dynamic execution of Python code. *source* must be
741741
either a string or a code object. If it is a string, the string is parsed as
742742
a suite of Python statements which is then executed (unless a syntax error
743-
occurs). [#]_ If it is a code object, it is simply executed. In all cases,
743+
occurs). If it is a code object, it is simply executed. In all cases,
744744
the code that's executed is expected to be valid as file input (see the
745745
section :ref:`file-input` in the Reference Manual). Be aware that the
746746
:keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return`
@@ -1950,7 +1950,7 @@ are always available. They are listed here in alphabetical order.
19501950
>>> MISSING
19511951
<MISSING>
19521952

1953-
Sentinel objects are truthy and compare equal only to themselves. They are
1953+
Sentinel objects are true and compare equal only to themselves. They are
19541954
intended to be compared with the :keyword:`is` operator.
19551955

19561956
``sentinel`` does not support subclassing.
@@ -2470,9 +2470,3 @@ are always available. They are listed here in alphabetical order.
24702470
.. versionchanged:: 3.9
24712471
When the command line options :option:`-E` or :option:`-I` are being used,
24722472
the environment variable :envvar:`PYTHONCASEOK` is now ignored.
2473-
2474-
.. rubric:: Footnotes
2475-
2476-
.. [#] Note that the parser only accepts the Unix-style end of line convention.
2477-
If you are reading the code from a file, make sure to use newline conversion
2478-
mode to convert Windows or Mac-style newlines.

‎Doc/builtins/stdtypes.rst‎

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,8 +1225,8 @@ the underlying generator function:
12251225
If the asynchronous generator function then exits gracefully, is already
12261226
closed, or raises :exc:`GeneratorExit` (by not catching the exception),
12271227
then the returned awaitable will raise a :exc:`StopIteration` exception.
1228-
Any further awaitables returned by subsequent calls to the asynchronous
1229-
generator will raise a :exc:`StopAsyncIteration` exception.
1228+
Awaitables returned by subsequent calls to :meth:`~agen.__anext__`
1229+
or :meth:`~agen.asend` will raise a :exc:`StopAsyncIteration` exception.
12301230

12311231
If the asynchronous generator yields a value, a :exc:`RuntimeError` is
12321232
raised by the awaitable.
@@ -2313,19 +2313,19 @@ expression support in the :mod:`re` module).
23132313

23142314
Perform a string formatting operation. The string on which this method is
23152315
called can contain literal text or replacement fields delimited by braces
2316-
``{}``. Each replacement field contains either the numeric index of a
2317-
positional argument, or the name of a keyword argument. Returns a copy of
2316+
``{}``. Each replacement field refers to a positional argument (numbered
2317+
explicitly or automatically) or a keyword argument. Returns a copy of
23182318
the string where each replacement field is replaced with the string value of
23192319
the corresponding argument. For example:
23202320

23212321
.. doctest::
23222322

2323-
>>> "The sum of 1 + 2 is {0}".format(1+2)
2324-
'The sum of 1 + 2 is 3'
2325-
>>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
2323+
>>> "The sum of {} + {} is {}".format(1, 2, 1+2)
23262324
'The sum of 1 + 2 is 3'
23272325
>>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
23282326
'Nobody expects the Spanish Inquisition!'
2327+
>>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
2328+
'The sum of 1 + 2 is 3'
23292329

23302330
See :ref:`formatstrings` for a description of the various formatting options
23312331
that can be specified in format strings.
@@ -3180,7 +3180,7 @@ expression support in the :mod:`re` module).
31803180

31813181
Return a copy of the string with all the cased characters [4]_ converted to
31823182
uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s``
3183-
contains uncased characters or if the Unicode category of the resulting
3183+
contains no cased characters or if the Unicode category of the resulting
31843184
character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter,
31853185
titlecase).
31863186

@@ -3537,9 +3537,8 @@ The conversion types are:
35373537
| | character in the result. | |
35383538
+------------+-----------------------------------------------------+-------+
35393539

3540-
For floating-point formats, the result should be correctly rounded to a given
3541-
precision ``p`` of digits after the decimal point. The rounding mode matches
3542-
that of the :func:`round` builtin.
3540+
For floating-point formats, the result should be correctly rounded to the
3541+
specified precision. The rounding mode matches that of the :func:`round` builtin.
35433542

35443543
Notes:
35453544

@@ -5928,8 +5927,9 @@ can be used interchangeably to index the same dictionary entry.
59285927

59295928

59305929
.. seealso::
5931-
:class:`frozendict` and :class:`types.MappingProxyType` can be used to
5932-
create a read-only view of a :class:`dict`.
5930+
:class:`types.MappingProxyType` can be used to create a read-only view
5931+
of a :class:`dict`. :class:`frozendict` is an immutable version of
5932+
:class:`dict`.
59335933

59345934
.. seealso::
59355935

@@ -6082,8 +6082,7 @@ Frozen dictionaries
60826082

60836083
Similar to :meth:`dict.fromkeys`, but call again the type constructor
60846084
with an initialized :class:`frozendict` if the type is a
6085-
:class:`frozendict` subclass or if the constructor returned a
6086-
:class:`frozendict`.
6085+
:class:`frozendict` subclass.
60876086

60886087
.. versionadded:: 3.15
60896088

@@ -6532,8 +6531,8 @@ The user-exposed type for the union object can be accessed from
65326531

65336532
.. note::
65346533
The :meth:`!__or__` method for type objects was added to support the syntax
6535-
``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may
6536-
override it:
6534+
``X | Y``. If a metaclass implements :meth:`!__or__`, it may override
6535+
the default behavior of creating a union:
65376536

65386537
.. doctest::
65396538

‎Doc/c-api/code.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ bound into a function.
4444
The old name is deprecated, but will remain available until the
4545
signature changes again.
4646
47+
.. c:function:: PyObject* PyUnstable_Code_GetLocalPlusNames(PyCodeObject *co)
48+
49+
Return a :term:`strong reference` to a tuple of names of the local, cell and
50+
free variables of a code object. The names are in the same order as the
51+
values returned by :c:func:`PyUnstable_InterpreterFrame_GetLocal`.
52+
53+
.. versionadded:: next
54+
4755
.. c:function:: PyCodeObject* PyUnstable_Code_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, PyObject *qualname, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
4856
4957
Return a new code object. If you need a dummy code object to create a frame,

‎Doc/c-api/frame.rst‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,21 @@ Unless using :pep:`523`, you will not need this.
241241
Return the currently executing line number, or -1 if there is no line number.
242242
243243
.. versionadded:: 3.12
244+
245+
246+
.. c:function:: int PyUnstable_InterpreterFrame_GetLocal(struct _PyInterpreterFrame *frame, Py_ssize_t index, PyObject **result)
247+
248+
Retrieve the local variable at *index*.
249+
To determine the index of a particular variable, use
250+
:c:func:`PyUnstable_InterpreterFrame_GetCode` and
251+
:c:func:`PyUnstable_Code_GetLocalPlusNames`.
252+
253+
Cell and free variables are unboxed to their contents. Free variables are
254+
resolved from the function closure, so this also works on a frame that has
255+
not started executing.
256+
257+
* On success, store a new :term:`strong reference` in *result* and return ``1``.
258+
* If the slot is unset or hidden, store ``NULL`` in *result* and return ``0``.
259+
* On error, raise an exception, store ``NULL`` in *result* and return ``-1``.
260+
261+
.. versionadded:: next

‎Doc/c-api/init_config.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,8 @@ PyConfig
12271227
12281228
.. c:member:: int safe_path
12291229
1230-
If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to
1231-
:data:`sys.path` at startup:
1230+
If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe
1231+
:data:`sys._path0` to :data:`sys.path` at startup:
12321232
12331233
* If :c:member:`argv[0] <PyConfig.argv>` is equal to ``L"-m"``
12341234
(``python -m module``), prepend the current working directory.

‎Doc/c-api/module.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,19 +552,19 @@ This means that if you have a module object, but you are not sure if it
552552
553553
.. code-block:: c
554554
555-
PyObject *module = <the module in question>
555+
PyObject *module = <the module in question>;
556556
557557
void *module_token;
558558
if (PyModule_GetToken(module, &module_token) < 0) {
559559
return NULL;
560560
}
561561
if (module_token != your_token) {
562-
PyErr_SetString(PyExc_ValueError, "unexpected module")
562+
PyErr_SetString(PyExc_ValueError, "unexpected module");
563563
return NULL;
564564
}
565565
566566
// This module's state has the expected memory layout; it's safe to cast
567-
struct my_state state = (struct my_state*)PyModule_GetState(module)
567+
struct my_state *state = (struct my_state*)PyModule_GetState(module);
568568
569569
A module's token -- and the *your_token* value to use in the above code -- is:
570570

‎Doc/c-api/typeobj.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3343,7 +3343,7 @@ A type that supports weakrefs, instance dicts, and hashing::
33433343
.tp_new = myobj_new,
33443344
.tp_traverse = (traverseproc)myobj_traverse,
33453345
.tp_clear = (inquiry)myobj_clear,
3346-
.tp_alloc = PyType_GenericNew,
3346+
.tp_alloc = PyType_GenericAlloc,
33473347
.tp_dealloc = (destructor)myobj_dealloc,
33483348
.tp_repr = (reprfunc)myobj_repr,
33493349
.tp_hash = (hashfunc)myobj_hash,

‎Doc/deprecations/pending-removal-in-3.21.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ Pending removal in Python 3.21
3737

3838
* ``tempfile._TemporaryFileWrapper`` will be removed in Python 3.21. Use the
3939
public :class:`tempfile.TemporaryFileWrapper` instead.
40+
41+
* :mod:`typing`:
42+
43+
* :data:`typing.AnyStr` has been discouraged
44+
and deprecated since Python 3.13
45+
and is scheduled to be removed in Python 3.21.
46+
Use :pep:`695` syntax instead.
47+
(Contributed by Nikita Sobolev in :gh:`150190`.)

0 commit comments

Comments
 (0)