Skip to content

Commit 6edaba0

Browse files
authored
Merge branch 'main' into tstrings
2 parents 0303c25 + c2eaeee commit 6edaba0

File tree

155 files changed

+3420
-1560
lines changed

Some content is hidden

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

155 files changed

+3420
-1560
lines changed

Doc/c-api/arg.rst

+6
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,19 @@ small to receive the value.
274274
Convert a Python integer to a C :c:expr:`unsigned long` without
275275
overflow checking.
276276

277+
.. versionchanged:: next
278+
Use :meth:`~object.__index__` if available.
279+
277280
``L`` (:class:`int`) [long long]
278281
Convert a Python integer to a C :c:expr:`long long`.
279282

280283
``K`` (:class:`int`) [unsigned long long]
281284
Convert a Python integer to a C :c:expr:`unsigned long long`
282285
without overflow checking.
283286

287+
.. versionchanged:: next
288+
Use :meth:`~object.__index__` if available.
289+
284290
``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
285291
Convert a Python integer to a C :c:type:`Py_ssize_t`.
286292

Doc/c-api/init.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ Cautions regarding runtime finalization
11311131
In the late stage of :term:`interpreter shutdown`, after attempting to wait for
11321132
non-daemon threads to exit (though this can be interrupted by
11331133
:class:`KeyboardInterrupt`) and running the :mod:`atexit` functions, the runtime
1134-
is marked as *finalizing*: :c:func:`_Py_IsFinalizing` and
1134+
is marked as *finalizing*: :c:func:`Py_IsFinalizing` and
11351135
:func:`sys.is_finalizing` return true. At this point, only the *finalization
11361136
thread* that initiated finalization (typically the main thread) is allowed to
11371137
acquire the :term:`GIL`.

Doc/deprecations/pending-removal-in-3.16.rst

+8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ Pending removal in Python 3.16
6161
* Calling the Python implementation of :func:`functools.reduce` with *function*
6262
or *sequence* as keyword arguments has been deprecated since Python 3.14.
6363

64+
* :mod:`mimetypes`:
65+
66+
* Valid extensions start with a '.' or are empty for
67+
:meth:`mimetypes.MimeTypes.add_type`.
68+
Undotted extensions are deprecated and will
69+
raise a :exc:`ValueError` in Python 3.16.
70+
(Contributed by Hugo van Kemenade in :gh:`75223`.)
71+
6472
* :mod:`shutil`:
6573

6674
* The :class:`!ExecError` exception

Doc/howto/remote_debugging.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ file format structures from the binary file on disk. The ELF header contains a
110110
pointer to the section header table. Each section header contains metadata about
111111
a section including its name (stored in a separate string table), offset, and
112112
size. To find a specific section like .PyRuntime, you need to walk through these
113-
headers and match the section name. The section header then provdes the offset
113+
headers and match the section name. The section header then provides the offset
114114
where that section exists in the file, which can be used to calculate its
115115
runtime address when the binary is loaded into memory.
116116

Doc/library/ast.rst

+37
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,43 @@ Pattern matching
17611761

17621762
.. versionadded:: 3.10
17631763

1764+
1765+
Type annotations
1766+
^^^^^^^^^^^^^^^^
1767+
1768+
.. class:: TypeIgnore(lineno, tag)
1769+
1770+
A ``# type: ignore`` comment located at *lineno*.
1771+
*tag* is the optional tag specified by the form ``# type: ignore <tag>``.
1772+
1773+
.. doctest::
1774+
1775+
>>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), indent=4))
1776+
Module(
1777+
body=[
1778+
Assign(
1779+
targets=[
1780+
Name(id='x', ctx=Store())],
1781+
value=Constant(value=1))],
1782+
type_ignores=[
1783+
TypeIgnore(lineno=1, tag='')])
1784+
>>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', type_comments=True), indent=4))
1785+
Module(
1786+
body=[
1787+
AnnAssign(
1788+
target=Name(id='x', ctx=Store()),
1789+
annotation=Name(id='bool', ctx=Load()),
1790+
value=Constant(value=1),
1791+
simple=1)],
1792+
type_ignores=[
1793+
TypeIgnore(lineno=1, tag='[assignment]')])
1794+
1795+
.. note::
1796+
:class:`!TypeIgnore` nodes are not generated when the *type_comments* parameter
1797+
is set to ``False`` (default). See :func:`ast.parse` for more details.
1798+
1799+
.. versionadded:: 3.8
1800+
17641801
.. _ast-type-params:
17651802

17661803
Type parameters

Doc/library/decimal.rst

+21-12
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,14 @@ function to temporarily change the active context.
10311031
.. versionchanged:: 3.11
10321032
:meth:`localcontext` now supports setting context attributes through the use of keyword arguments.
10331033

1034+
.. function:: IEEEContext(bits)
1035+
1036+
Return a context object initialized to the proper values for one of the
1037+
IEEE interchange formats. The argument must be a multiple of 32 and less
1038+
than :const:`IEEE_CONTEXT_MAX_BITS`.
1039+
1040+
.. versionadded:: next
1041+
10341042
New contexts can also be created using the :class:`Context` constructor
10351043
described below. In addition, the module provides three pre-made contexts:
10361044

@@ -1552,18 +1560,19 @@ Constants
15521560
The constants in this section are only relevant for the C module. They
15531561
are also included in the pure Python version for compatibility.
15541562

1555-
+---------------------+---------------------+-------------------------------+
1556-
| | 32-bit | 64-bit |
1557-
+=====================+=====================+===============================+
1558-
| .. data:: MAX_PREC | ``425000000`` | ``999999999999999999`` |
1559-
+---------------------+---------------------+-------------------------------+
1560-
| .. data:: MAX_EMAX | ``425000000`` | ``999999999999999999`` |
1561-
+---------------------+---------------------+-------------------------------+
1562-
| .. data:: MIN_EMIN | ``-425000000`` | ``-999999999999999999`` |
1563-
+---------------------+---------------------+-------------------------------+
1564-
| .. data:: MIN_ETINY | ``-849999999`` | ``-1999999999999999997`` |
1565-
+---------------------+---------------------+-------------------------------+
1566-
1563+
+---------------------------------+---------------------+-------------------------------+
1564+
| | 32-bit | 64-bit |
1565+
+=================================+=====================+===============================+
1566+
| .. data:: MAX_PREC | ``425000000`` | ``999999999999999999`` |
1567+
+---------------------------------+---------------------+-------------------------------+
1568+
| .. data:: MAX_EMAX | ``425000000`` | ``999999999999999999`` |
1569+
+---------------------------------+---------------------+-------------------------------+
1570+
| .. data:: MIN_EMIN | ``-425000000`` | ``-999999999999999999`` |
1571+
+---------------------------------+---------------------+-------------------------------+
1572+
| .. data:: MIN_ETINY | ``-849999999`` | ``-1999999999999999997`` |
1573+
+---------------------------------+---------------------+-------------------------------+
1574+
| .. data:: IEEE_CONTEXT_MAX_BITS | ``256`` | ``512`` |
1575+
+---------------------------------+---------------------+-------------------------------+
15671576

15681577
.. data:: HAVE_THREADS
15691578

Doc/library/exceptions.rst

+4
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,17 @@ The following exceptions are the exceptions that are usually raised.
428428
:exc:`PythonFinalizationError` during the Python finalization:
429429

430430
* Creating a new Python thread.
431+
* :meth:`Joining <threading.Thread.join>` a running daemon thread.
431432
* :func:`os.fork`.
432433

433434
See also the :func:`sys.is_finalizing` function.
434435

435436
.. versionadded:: 3.13
436437
Previously, a plain :exc:`RuntimeError` was raised.
437438

439+
.. versionchanged:: next
440+
441+
:meth:`threading.Thread.join` can now raise this exception.
438442

439443
.. exception:: RecursionError
440444

Doc/library/faulthandler.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ Dumping the C stack
8484
C Stack Compatibility
8585
*********************
8686

87-
If the system does not support the C-level :manpage:`backtrace(3)`,
88-
:manpage:`backtrace_symbols(3)`, or :manpage:`dladdr(3)`, then C stack dumps
89-
will not work. An error will be printed instead of the stack.
87+
If the system does not support the C-level :manpage:`backtrace(3)`
88+
or :manpage:`dladdr1(3)`, then C stack dumps will not work.
89+
An error will be printed instead of the stack.
9090

9191
Additionally, some compilers do not support :term:`CPython's <CPython>`
9292
implementation of C stack dumps. As a result, a different error may be printed

Doc/library/importlib.metadata.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Distribution files
297297
package is not installed in the current Python environment.
298298

299299
Returns :const:`None` if the distribution is found but the installation
300-
database records reporting the files associated with the distribuion package
300+
database records reporting the files associated with the distribution package
301301
are missing.
302302

303303
.. class:: PackagePath

Doc/library/mimetypes.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,18 @@ than one MIME-type database; it provides an interface similar to the one of the
301301

302302
.. method:: MimeTypes.add_type(type, ext, strict=True)
303303

304-
Add a mapping from the MIME type *type* to the extension *ext*. When the
304+
Add a mapping from the MIME type *type* to the extension *ext*.
305+
Valid extensions start with a '.' or are empty. When the
305306
extension is already known, the new type will replace the old one. When the type
306307
is already known the extension will be added to the list of known extensions.
307308

308309
When *strict* is ``True`` (the default), the mapping will be added to the
309310
official MIME types, otherwise to the non-standard ones.
310311

312+
.. deprecated-removed:: 3.14 3.16
313+
Invalid, undotted extensions will raise a
314+
:exc:`ValueError` in Python 3.16.
315+
311316

312317
.. _mimetypes-cli:
313318

Doc/library/socket.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ Constants
476476
network interface instead of its name.
477477

478478
.. versionchanged:: 3.14
479-
Added missing ``IP_RECVERR``, ``IPV6_RECVERR``, ``IP_RECVTTL``, and
480-
``IP_RECVORIGDSTADDR`` on Linux.
479+
Added missing ``IP_FREEBIND``, ``IP_RECVERR``, ``IPV6_RECVERR``,
480+
``IP_RECVTTL``, and ``IP_RECVORIGDSTADDR`` on Linux.
481481

482482
.. versionchanged:: 3.14
483483
Added support for ``TCP_QUICKACK`` on Windows platforms when available.

Doc/library/sysconfig.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,10 @@ Other functions
429429
Return the path of :file:`Makefile`.
430430

431431
.. _sysconfig-cli:
432+
.. _using-sysconfig-as-a-script:
432433

433-
Using :mod:`sysconfig` as a script
434-
----------------------------------
434+
Command-line usage
435+
------------------
435436

436437
You can use :mod:`sysconfig` as a script with Python's *-m* option:
437438

Doc/library/tarfile.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Some facts and figures:
112112
``'w|bz2'``, :func:`tarfile.open` accepts the keyword argument
113113
*compresslevel* (default ``9``) to specify the compression level of the file.
114114

115-
For modes ``'w:xz'`` and ``'x:xz'``, :func:`tarfile.open` accepts the
115+
For modes ``'w:xz'``, ``'x:xz'`` and ``'w|xz'``, :func:`tarfile.open` accepts the
116116
keyword argument *preset* to specify the compression level of the file.
117117

118118
For special purposes, there is a second format for *mode*:
@@ -167,6 +167,9 @@ Some facts and figures:
167167
.. versionchanged:: 3.12
168168
The *compresslevel* keyword argument also works for streams.
169169

170+
.. versionchanged:: next
171+
The *preset* keyword argument also works for streams.
172+
170173

171174
.. class:: TarFile
172175
:noindex:

Doc/library/threading.rst

+8
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,14 @@ since it is impossible to detect the termination of alien threads.
448448
an error to :meth:`~Thread.join` a thread before it has been started
449449
and attempts to do so raise the same exception.
450450

451+
If an attempt is made to join a running daemonic thread in in late stages
452+
of :term:`Python finalization <interpreter shutdown>` :meth:`!join`
453+
raises a :exc:`PythonFinalizationError`.
454+
455+
.. versionchanged:: next
456+
457+
May raise :exc:`PythonFinalizationError`.
458+
451459
.. attribute:: name
452460

453461
A string used for identification purposes only. It has no semantics.

0 commit comments

Comments
 (0)