Skip to content

Commit 31aa216

Browse files
authored
Merge branch 'main' into fix_test_sys
2 parents 5e4c2a7 + 0e4cf9c commit 31aa216

File tree

98 files changed

+1531
-465
lines changed

Some content is hidden

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

98 files changed

+1531
-465
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tags
3838
TAGS
3939
.vs/
4040
.vscode/
41+
.cache/
4142
gmon.out
4243
.coverage
4344
.mypy_cache/

Doc/c-api/arg.rst

+17-2
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,26 @@ Other objects
357357

358358
.. versionadded:: 3.3
359359

360-
``(items)`` (:class:`tuple`) [*matching-items*]
361-
The object must be a Python sequence whose length is the number of format units
360+
``(items)`` (sequence) [*matching-items*]
361+
The object must be a Python sequence (except :class:`str`, :class:`bytes`
362+
or :class:`bytearray`) whose length is the number of format units
362363
in *items*. The C arguments must correspond to the individual format units in
363364
*items*. Format units for sequences may be nested.
364365

366+
If *items* contains format units which store a :ref:`borrowed buffer
367+
<c-arg-borrowed-buffer>` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``)
368+
or a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``),
369+
the object must be a Python tuple.
370+
The *converter* for the ``O&`` format unit in *items* must not store
371+
a borrowed buffer or a borrowed reference.
372+
373+
.. versionchanged:: next
374+
:class:`str` and :class:`bytearray` objects no longer accepted as a sequence.
375+
376+
.. deprecated:: next
377+
Non-tuple sequences are deprecated if *items* contains format units
378+
which store a borrowed buffer or a borrowed reference.
379+
365380
A few other characters have a meaning in a format string. These may not occur
366381
inside nested parentheses. They are:
367382

Doc/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,12 @@
631631
'line_color': '#3776ab',
632632
}
633633
ogp_custom_meta_tags = [
634-
'<meta name="theme-color" content="#3776ab" />',
634+
'<meta name="theme-color" content="#3776ab">',
635635
]
636636
if 'create-social-cards' not in tags: # noqa: F821
637637
# Define a static preview image when not creating social cards
638638
ogp_image = '_static/og-image.png'
639639
ogp_custom_meta_tags += [
640-
'<meta property="og:image:width" content="200" />',
641-
'<meta property="og:image:height" content="200" />',
640+
'<meta property="og:image:width" content="200">',
641+
'<meta property="og:image:height" content="200">',
642642
]

Doc/includes/email-alternative.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
recette
3737
</a> sera sûrement un très bon repas.
3838
</p>
39-
<img src="cid:{asparagus_cid}" />
39+
<img src="cid:{asparagus_cid}">
4040
</body>
4141
</html>
4242
""".format(asparagus_cid=asparagus_cid[1:-1]), subtype='html')

Doc/library/cmath.rst

+51
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,57 @@ the function is then applied to the result of the conversion.
3838
1.4142135623730951j
3939

4040

41+
==================================================== ============================================
42+
**Conversions to and from polar coordinates**
43+
--------------------------------------------------------------------------------------------------
44+
:func:`phase(z) <phase>` Return the phase of *z*
45+
:func:`polar(z) <polar>` Return the representation of *z* in polar coordinates
46+
:func:`rect(r, phi) <rect>` Return the complex number *z* with polar coordinates *r* and *phi*
47+
48+
**Power and logarithmic functions**
49+
--------------------------------------------------------------------------------------------------
50+
:func:`exp(z) <exp>` Return *e* raised to the power *z*
51+
:func:`log(z[, base]) <log>` Return the logarithm of *z* to the given *base* (*e* by default)
52+
:func:`log10(z) <log10>` Return the base-10 logarithm of *z*
53+
:func:`sqrt(z) <sqrt>` Return the square root of *z*
54+
55+
**Trigonometric functions**
56+
--------------------------------------------------------------------------------------------------
57+
:func:`acos(z) <acos>` Return the arc cosine of *z*
58+
:func:`asin(z) <asin>` Return the arc sine of *z*
59+
:func:`atan(z) <atan>` Return the arc tangent of *z*
60+
:func:`cos(z) <cos>` Return the cosine of *z*
61+
:func:`sin(z) <sin>` Return the sine of *z*
62+
:func:`tan(z) <tan>` Return the tangent of *z*
63+
64+
**Hyperbolic functions**
65+
--------------------------------------------------------------------------------------------------
66+
:func:`acosh(z) <acosh>` Return the inverse hyperbolic cosine of *z*
67+
:func:`asinh(z) <asinh>` Return the inverse hyperbolic sine of *z*
68+
:func:`atanh(z) <atanh>` Return the inverse hyperbolic tangent of *z*
69+
:func:`cosh(z) <cosh>` Return the hyperbolic cosine of *z*
70+
:func:`sinh(z) <sinh>` Return the hyperbolic sine of *z*
71+
:func:`tanh(z) <tanh>` Return the hyperbolic tangent of *z*
72+
73+
**Classification functions**
74+
--------------------------------------------------------------------------------------------------
75+
:func:`isfinite(z) <isfinite>` Check if all components of *z* are finite
76+
:func:`isinf(z) <isinf>` Check if any component of *z* is infinite
77+
:func:`isnan(z) <isnan>` Check if any component of *z* is a NaN
78+
:func:`isclose(a, b, *, rel_tol, abs_tol) <isclose>` Check if the values *a* and *b* are close to each other
79+
80+
**Constants**
81+
--------------------------------------------------------------------------------------------------
82+
:data:`pi` *π* = 3.141592...
83+
:data:`e` *e* = 2.718281...
84+
:data:`tau` *τ* = 2\ *π* = 6.283185...
85+
:data:`inf` Positive infinity
86+
:data:`infj` Pure imaginary infinity
87+
:data:`nan` "Not a number" (NaN)
88+
:data:`nanj` Pure imaginary NaN
89+
==================================================== ============================================
90+
91+
4192
Conversions to and from polar coordinates
4293
-----------------------------------------
4394

Doc/library/concurrent.futures.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ the bytes over a shared :mod:`socket <socket>` or
298298

299299
The optional *initializer* and *initargs* arguments have the same
300300
meaning as for :class:`!ThreadPoolExecutor`: the initializer is run
301-
when each worker is created, though in this case it is run.in
301+
when each worker is created, though in this case it is run in
302302
the worker's interpreter. The executor serializes the *initializer*
303303
and *initargs* using :mod:`pickle` when sending them to the worker's
304304
interpreter.

Doc/library/ctypes.rst

+3
Original file line numberDiff line numberDiff line change
@@ -2632,6 +2632,9 @@ These are the fundamental ctypes data types:
26322632
Represents the C :c:expr:`PyObject *` datatype. Calling this without an
26332633
argument creates a ``NULL`` :c:expr:`PyObject *` pointer.
26342634

2635+
.. versionchanged:: next
2636+
:class:`!py_object` is now a :term:`generic type`.
2637+
26352638
The :mod:`!ctypes.wintypes` module provides quite some other Windows specific
26362639
data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:type:`!DWORD`.
26372640
Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` are also defined.

Doc/library/dataclasses.rst

+7-4
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Module contents
164164

165165
- *match_args*: If true (the default is ``True``), the
166166
:attr:`~object.__match_args__` tuple will be created from the list of
167-
parameters to the generated :meth:`~object.__init__` method (even if
167+
non keyword-only parameters to the generated :meth:`~object.__init__` method (even if
168168
:meth:`!__init__` is not generated, see above). If false, or if
169169
:attr:`!__match_args__` is already defined in the class, then
170170
:attr:`!__match_args__` will not be generated.
@@ -175,11 +175,12 @@ Module contents
175175
fields will be marked as keyword-only. If a field is marked as
176176
keyword-only, then the only effect is that the :meth:`~object.__init__`
177177
parameter generated from a keyword-only field must be specified
178-
with a keyword when :meth:`!__init__` is called. There is no
179-
effect on any other aspect of dataclasses. See the
180-
:term:`parameter` glossary entry for details. Also see the
178+
with a keyword when :meth:`!__init__` is called. See the :term:`parameter`
179+
glossary entry for details. Also see the
181180
:const:`KW_ONLY` section.
182181

182+
Keyword-only fields are not included in :attr:`!__match_args__`.
183+
183184
.. versionadded:: 3.10
184185

185186
- *slots*: If true (the default is ``False``), :attr:`~object.__slots__` attribute
@@ -299,6 +300,8 @@ Module contents
299300
This is used when the generated :meth:`~object.__init__` method's
300301
parameters are computed.
301302

303+
Keyword-only fields are also not included in :attr:`!__match_args__`.
304+
302305
.. versionadded:: 3.10
303306

304307
- ``doc``: optional docstring for this field.

Doc/library/fnmatch.rst

+10
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`.
9090
but implemented more efficiently.
9191

9292

93+
.. function:: filterfalse(names, pat)
94+
95+
Construct a list from those elements of the :term:`iterable` of filename
96+
strings *names* that do not match the pattern string *pat*.
97+
It is the same as ``[n for n in names if not fnmatch(n, pat)]``,
98+
but implemented more efficiently.
99+
100+
.. versionadded:: next
101+
102+
93103
.. function:: translate(pat)
94104

95105
Return the shell-style pattern *pat* converted to a regular expression for

Doc/library/json.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ Encoders and Decoders
486486
(to raise :exc:`TypeError`).
487487

488488
If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when
489-
trying to encode keys that are not :class:`str`, :class:`int`, :class:`float`
490-
or ``None``. If *skipkeys* is true, such items are simply skipped.
489+
trying to encode keys that are not :class:`str`, :class:`int`, :class:`float`,
490+
:class:`bool` or ``None``. If *skipkeys* is true, such items are simply skipped.
491491

492492
If *ensure_ascii* is true (the default), the output is guaranteed to
493493
have all incoming non-ASCII characters escaped. If *ensure_ascii* is

Doc/library/multiprocessing.rst

+14
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,13 @@ object -- see :ref:`multiprocessing-managers`.
14211421
when invoked on an unlocked lock, a :exc:`ValueError` is raised.
14221422

14231423

1424+
.. method:: locked()
1425+
1426+
Return a boolean indicating whether this object is locked right now.
1427+
1428+
.. versionadded:: next
1429+
1430+
14241431
.. class:: RLock()
14251432

14261433
A recursive lock object: a close analog of :class:`threading.RLock`. A
@@ -1481,6 +1488,13 @@ object -- see :ref:`multiprocessing-managers`.
14811488
differs from the implemented behavior in :meth:`threading.RLock.release`.
14821489

14831490

1491+
.. method:: locked()
1492+
1493+
Return a boolean indicating whether this object is locked right now.
1494+
1495+
.. versionadded:: next
1496+
1497+
14841498
.. class:: Semaphore([value])
14851499

14861500
A semaphore object: a close analog of :class:`threading.Semaphore`.

Doc/library/string.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -737,10 +737,10 @@ Using the comma or the underscore as a digit group separator::
737737
'4996_02d2'
738738
>>> '{:_}'.format(123456789.123456789)
739739
'123_456_789.12345679'
740-
>>> '{:._}'.format(123456789.123456789)
741-
'123456789.123_456_79'
742-
>>> '{:_._}'.format(123456789.123456789)
743-
'123_456_789.123_456_79'
740+
>>> '{:.,}'.format(123456789.123456789)
741+
'123456789.123,456,79'
742+
>>> '{:,._}'.format(123456789.123456789)
743+
'123,456,789.123_456_79'
744744

745745
Expressing a percentage::
746746

Doc/library/threading.rst

+13
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,13 @@ call release as many times the lock has been acquired can lead to deadlock.
709709
There is no return value.
710710

711711

712+
.. method:: locked()
713+
714+
Return a boolean indicating whether this object is locked right now.
715+
716+
.. versionadded:: next
717+
718+
712719
.. _condition-objects:
713720

714721
Condition Objects
@@ -801,6 +808,12 @@ item to the buffer only needs to wake up one consumer thread.
801808
Release the underlying lock. This method calls the corresponding method on
802809
the underlying lock; there is no return value.
803810

811+
.. method:: locked()
812+
813+
Return a boolean indicating whether this object is locked right now.
814+
815+
.. versionadded:: next
816+
804817
.. method:: wait(timeout=None)
805818

806819
Wait until notified or until a timeout occurs. If the calling thread has

Doc/library/uuid.rst

+13-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ which relays any information about the UUID's safety, using this enumeration:
121121
- The last 48 bits of the UUID. Only relevant to version 1.
122122

123123
* - .. attribute:: UUID.time
124-
- The 60-bit timestamp for version 1 and 6,
125-
or the 48-bit timestamp for version 7.
124+
- The 60-bit timestamp as a count of 100-nanosecond intervals since
125+
Gregorian epoch (1582-10-15 00:00:00) for versions 1 and 6, or the
126+
48-bit timestamp in milliseconds since Unix epoch (1970-01-01 00:00:00)
127+
for version 7.
126128

127129
* - .. attribute:: UUID.clock_seq
128130
- The 14-bit sequence number. Only relevant to versions 1 and 6.
@@ -434,6 +436,15 @@ Here are some examples of typical usage of the :mod:`uuid` module::
434436
>>> uuid.MAX
435437
UUID('ffffffff-ffff-ffff-ffff-ffffffffffff')
436438

439+
>>> # get UUIDv7 creation (local) time as a timestamp in milliseconds
440+
>>> u = uuid.uuid7()
441+
>>> u.time # doctest: +SKIP
442+
1743936859822
443+
>>> # get UUIDv7 creation (local) time as a datetime object
444+
>>> import datetime as dt
445+
>>> dt.datetime.fromtimestamp(u.time / 1000) # doctest: +SKIP
446+
datetime.datetime(...)
447+
437448

438449
.. _uuid-cli-example:
439450

Doc/library/zipfile.rst

+8
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,14 @@ The following data attributes are also available:
538538
it should be no longer than 65535 bytes. Comments longer than this will be
539539
truncated.
540540

541+
.. attribute:: ZipFile.data_offset
542+
543+
The offset to the start of ZIP data from the beginning of the file. When the
544+
:class:`ZipFile` is opened in either mode ``'w'`` or ``'x'`` and the
545+
underlying file does not support ``tell()``, the value will be ``None``
546+
instead.
547+
548+
.. versionadded:: 3.14
541549

542550
.. _path-objects:
543551

Doc/tools/templates/download.html

+14
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212
{% set dl_version = release %}
1313
{% endif %}
1414

15+
{%- block extrahead -%}
16+
{{ super() }}
17+
<meta property="og:title" content="Download — Python {{ dl_version }} documentation">
18+
<meta property="og:type" content="website">
19+
<meta property="og:url" content="https://docs.python.org/3/download.html">
20+
<meta property="og:site_name" content="Python documentation">
21+
<meta property="og:description" content="Download Python documentation.">
22+
<meta property="og:image" content="https://docs.python.org/3/_static/og-image.png">
23+
<meta name="description" content="Download Python documentation.">
24+
<meta property="og:image:width" content="200">
25+
<meta property="og:image:height" content="200">
26+
<meta name="theme-color" content="#3776ab">
27+
{%- endblock -%}
28+
1529
{% block body %}
1630
<h1>{% trans %}Download Python {{ dl_version }} Documentation{% endtrans %}</h1>
1731

0 commit comments

Comments
 (0)