Skip to content

Commit 49fbc54

Browse files
authored
Merge branch 'main' into email-header-accumulator
2 parents af48160 + 7ac989f commit 49fbc54

721 files changed

Lines changed: 13560 additions & 3800 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: 16 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
@@ -494,6 +498,11 @@ Lib/_markupbase.py @ezio-melotti
494498
Lib/test/test_html*.py @ezio-melotti
495499
Tools/build/parse_html5_entities.py @ezio-melotti
496500

501+
# HTTP
502+
Doc/library/http* @orsenthil
503+
Lib/http/ @orsenthil
504+
Lib/test/test_http*.py @orsenthil
505+
497506
# IDLE
498507
Doc/library/idle.rst @terryjreedy
499508
Lib/idlelib/ @terryjreedy
@@ -629,6 +638,11 @@ Modules/_typesmodule.c @AA-Turner
629638
Lib/unittest/mock.py @cjw296
630639
Lib/test/test_unittest/testmock/ @cjw296
631640

641+
# Urllib
642+
Doc/library/urllib* @orsenthil
643+
Lib/urllib/ @orsenthil
644+
Lib/test/test_urllib*.py @orsenthil
645+
632646
# Venv
633647
**/*venv* @vsajip @FFY00
634648

‎.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

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*.pyo
2121
*.rej
2222
*.swp
23+
*.pickle
2324
*~
2425
*.gc??
2526
*.profclang?

‎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: 28 additions & 19 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.
@@ -2129,13 +2129,23 @@ expression support in the :mod:`re` module).
21292129
.. method:: str.capitalize()
21302130

21312131
Return a copy of the string with its first character capitalized and the
2132-
rest lowercased.
2132+
rest lowercased. For example:
2133+
2134+
.. doctest::
2135+
2136+
>>> 'PYTHON IS AMAZING'.capitalize()
2137+
'Python is amazing'
2138+
>>> 'Njemačka starts With a non-ASCII digraph'.capitalize()
2139+
'Njemačka starts with a non-ascii digraph'
2140+
2141+
See also :meth:`title`.
21332142

21342143
.. versionchanged:: 3.8
21352144
The first character is now put into titlecase rather than uppercase.
21362145
This means that characters like digraphs will only have their first
21372146
letter capitalized, instead of the full character.
21382147

2148+
21392149
.. method:: str.casefold()
21402150

21412151
Return a casefolded copy of the string. Casefolded strings may be used for
@@ -2303,19 +2313,19 @@ expression support in the :mod:`re` module).
23032313

23042314
Perform a string formatting operation. The string on which this method is
23052315
called can contain literal text or replacement fields delimited by braces
2306-
``{}``. Each replacement field contains either the numeric index of a
2307-
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
23082318
the string where each replacement field is replaced with the string value of
23092319
the corresponding argument. For example:
23102320

23112321
.. doctest::
23122322

2313-
>>> "The sum of 1 + 2 is {0}".format(1+2)
2314-
'The sum of 1 + 2 is 3'
2315-
>>> "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)
23162324
'The sum of 1 + 2 is 3'
23172325
>>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
23182326
'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'
23192329

23202330
See :ref:`formatstrings` for a description of the various formatting options
23212331
that can be specified in format strings.
@@ -3137,7 +3147,7 @@ expression support in the :mod:`re` module).
31373147
>>> titlecase("they're bill's friends.")
31383148
"They're Bill's Friends."
31393149

3140-
See also :meth:`istitle`.
3150+
See also :meth:`istitle` and :meth:`capitalize`.
31413151

31423152

31433153
.. method:: str.translate(table, /)
@@ -3170,7 +3180,7 @@ expression support in the :mod:`re` module).
31703180

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

@@ -3527,9 +3537,8 @@ The conversion types are:
35273537
| | character in the result. | |
35283538
+------------+-----------------------------------------------------+-------+
35293539

3530-
For floating-point formats, the result should be correctly rounded to a given
3531-
precision ``p`` of digits after the decimal point. The rounding mode matches
3532-
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.
35333542

35343543
Notes:
35353544

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

59195928

59205929
.. seealso::
5921-
:class:`frozendict` and :class:`types.MappingProxyType` can be used to
5922-
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`.
59235933

59245934
.. seealso::
59255935

@@ -6072,8 +6082,7 @@ Frozen dictionaries
60726082

60736083
Similar to :meth:`dict.fromkeys`, but call again the type constructor
60746084
with an initialized :class:`frozendict` if the type is a
6075-
:class:`frozendict` subclass or if the constructor returned a
6076-
:class:`frozendict`.
6085+
:class:`frozendict` subclass.
60776086

60786087
.. versionadded:: 3.15
60796088

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

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

65286537
.. doctest::
65296538

‎Doc/builtins/threadsafety.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,3 +604,13 @@ underlying object supports it:
604604
Resizing or reallocating the underlying object (such as calling
605605
:meth:`bytearray.resize`) while a memoryview is exported raises
606606
:exc:`BufferError`. This is enforced regardless of threading.
607+
608+
In the :term:`free-threaded build`, :meth:`~memoryview.release` is
609+
thread-safe. If another thread has an in-flight operation on the memoryview
610+
when it is released, the underlying buffer may remain exported until that
611+
operation completes. Restrictions on the exporter, such as prohibiting
612+
resizing, remain in effect until then.
613+
614+
For read-heavy workloads that share an underlying object across threads,
615+
creating a separate memoryview of that object in each thread may improve
616+
performance.

‎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:: 3.16
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/conversion.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,4 @@ macros above:
277277
Values used internally by the ``Py_IS*`` classification macros above.
278278
Exposed for backwards compatibility only.
279279
280-
.. soft-deprecated:: next
280+
.. soft-deprecated:: 3.16

‎Doc/c-api/dict.rst‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,29 @@ Dictionary objects
507507
modified by another thread.
508508
509509
510+
.. c:function:: PyObject* PyDict_AsFrozenDictAndClear(PyObject *dict)
511+
512+
Return a new :class:`frozendict` created
513+
from the existing :class:`dict` instance.
514+
515+
Transfers all keys and values from *dict*
516+
to the newly allocated :class:`!frozendict`.
517+
Clears the input *dict* on success.
518+
Returns ``NULL`` with the exception set on error.
519+
520+
This function is intended for building a :class:`!frozendict` instance via
521+
a temporary *dict* that is not exposed to user code.
522+
To "freeze" an arbitrary dictionary, for example one received from the user
523+
as an argument, prefer :c:func:`PyFrozenDict_New` to leave the source
524+
intact.
525+
526+
.. impl-detail::
527+
528+
Works with O(1) complexity.
529+
530+
.. versionadded:: 3.16
531+
532+
510533
.. c:function:: int PyDict_AddWatcher(PyDict_WatchCallback callback)
511534
512535
Register *callback* as a dictionary watcher. Return a non-negative integer

‎Doc/c-api/exceptions.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,19 +1350,19 @@ to :c:data:`PyExc_OSError`.
13501350
13511351
.. c:var:: PyObject *PyExc_EnvironmentError
13521352
1353-
.. soft-deprecated:: next
1353+
.. soft-deprecated:: 3.16
13541354
Use :c:data:`PyExc_OSError` instead.
13551355
13561356
.. c:var:: PyObject *PyExc_IOError
13571357
1358-
.. soft-deprecated:: next
1358+
.. soft-deprecated:: 3.16
13591359
Use :c:data:`PyExc_OSError` instead.
13601360
13611361
.. c:var:: PyObject *PyExc_WindowsError
13621362
13631363
.. availability:: Windows
13641364
1365-
.. soft-deprecated:: next
1365+
.. soft-deprecated:: 3.16
13661366
Use :c:data:`PyExc_OSError` instead.
13671367
13681368

0 commit comments

Comments
 (0)