Skip to content

Commit 0de5aff

Browse files
committed
Merge branch 'main' into typewatch
* main: pythongh-86298: Ensure that __loader__ and __spec__.loader agree in warnings.warn_explicit() (pythonGH-97803) pythongh-82874: Convert remaining importlib format uses to f-str. (python#98005) Docs: Fix backtick errors found by sphinx-lint (python#97998) pythongh-97850: Remove deprecated functions from `importlib.utils` (python#97898) Remove extra spaces in custom openSSL documentation. (python#93568) pythonGH-90985: Revert "Deprecate passing a message into cancel()" (python#97999)
2 parents 29e38df + 13d4489 commit 0de5aff

Some content is hidden

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

75 files changed

+322
-614
lines changed

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,7 @@ is not possible due to its implementation being opaque at build time.
19291929
Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after
19301930
first calling :c:func:`PyThread_tss_delete` to ensure any associated
19311931
thread locals have been unassigned. This is a no-op if the *key*
1932-
argument is `NULL`.
1932+
argument is ``NULL``.
19331933
19341934
.. note::
19351935
A freed key becomes a dangling pointer. You should reset the key to

Doc/c-api/type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Type Objects
4040
.. c:function:: unsigned long PyType_GetFlags(PyTypeObject* type)
4141
4242
Return the :c:member:`~PyTypeObject.tp_flags` member of *type*. This function is primarily
43-
meant for use with `Py_LIMITED_API`; the individual flag bits are
43+
meant for use with ``Py_LIMITED_API``; the individual flag bits are
4444
guaranteed to be stable across Python releases, but access to
4545
:c:member:`~PyTypeObject.tp_flags` itself is not part of the limited API.
4646

Doc/faq/design.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Why can't I use an assignment in an expression?
155155

156156
Starting in Python 3.8, you can!
157157

158-
Assignment expressions using the walrus operator `:=` assign a variable in an
158+
Assignment expressions using the walrus operator ``:=`` assign a variable in an
159159
expression::
160160

161161
while chunk := fp.read(200):

Doc/howto/enum.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ Enum Classes
11091109
The :class:`EnumType` metaclass is responsible for providing the
11101110
:meth:`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that
11111111
allow one to do things with an :class:`Enum` class that fail on a typical
1112-
class, such as `list(Color)` or `some_enum_var in Color`. :class:`EnumType` is
1112+
class, such as ``list(Color)`` or ``some_enum_var in Color``. :class:`EnumType` is
11131113
responsible for ensuring that various other methods on the final :class:`Enum`
11141114
class are correct (such as :meth:`__new__`, :meth:`__getnewargs__`,
11151115
:meth:`__str__` and :meth:`__repr__`).

Doc/howto/logging-cookbook.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ To run a logging listener in production, you may need to use a process-managemen
562562
such as `Supervisor <http://supervisord.org/>`_. `Here
563563
<https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b>`_ is a Gist which
564564
provides the bare-bones files to run the above functionality using Supervisor: you
565-
will need to change the `/path/to/` parts in the Gist to reflect the actual paths you
565+
will need to change the ``/path/to/`` parts in the Gist to reflect the actual paths you
566566
want to use.
567567

568568

@@ -2774,7 +2774,7 @@ Formatting times using UTC (GMT) via configuration
27742774
--------------------------------------------------
27752775

27762776
Sometimes you want to format times using UTC, which can be done using a class
2777-
such as `UTCFormatter`, shown below::
2777+
such as ``UTCFormatter``, shown below::
27782778

27792779
import logging
27802780
import time

Doc/howto/logging.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -555,14 +555,14 @@ raw message. If there is no date format string, the default date format is:
555555
556556
%Y-%m-%d %H:%M:%S
557557
558-
with the milliseconds tacked on at the end. The ``style`` is one of `%`, '{'
559-
or '$'. If one of these is not specified, then '%' will be used.
558+
with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``,
559+
``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be used.
560560

561-
If the ``style`` is '%', the message format string uses
561+
If the ``style`` is ``'%'``, the message format string uses
562562
``%(<dictionary key>)s`` styled string substitution; the possible keys are
563-
documented in :ref:`logrecord-attributes`. If the style is '{', the message
563+
documented in :ref:`logrecord-attributes`. If the style is ``'{'``, the message
564564
format string is assumed to be compatible with :meth:`str.format` (using
565-
keyword arguments), while if the style is '$' then the message format string
565+
keyword arguments), while if the style is ``'$'`` then the message format string
566566
should conform to what is expected by :meth:`string.Template.substitute`.
567567

568568
.. versionchanged:: 3.2

Doc/howto/perf_profiling.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Enabling perf profiling mode
151151
----------------------------
152152

153153
There are two main ways to activate the perf profiling mode. If you want it to be
154-
active since the start of the Python interpreter, you can use the `-Xperf` option:
154+
active since the start of the Python interpreter, you can use the ``-Xperf`` option:
155155

156156
$ python -Xperf my_script.py
157157

Doc/install/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ And on Windows, the configuration files are:
765765
+--------------+-------------------------------------------------+-------+
766766

767767
On all platforms, the "personal" file can be temporarily disabled by
768-
passing the `--no-user-cfg` option.
768+
passing the ``--no-user-cfg`` option.
769769

770770
Notes:
771771

Doc/library/asyncio-future.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,6 @@ Future Object
197197
.. versionchanged:: 3.9
198198
Added the *msg* parameter.
199199

200-
.. deprecated-removed:: 3.11 3.14
201-
*msg* parameter is ambiguous when multiple :meth:`cancel`
202-
are called with different cancellation messages.
203-
The argument will be removed.
204-
205200
.. method:: exception()
206201

207202
Return the exception that was set on this Future.
@@ -282,8 +277,3 @@ the Future has a result::
282277

283278
- :meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument,
284279
but :func:`concurrent.futures.cancel` does not.
285-
286-
.. deprecated-removed:: 3.11 3.14
287-
*msg* parameter is ambiguous when multiple :meth:`cancel`
288-
are called with different cancellation messages.
289-
The argument will be removed.

Doc/library/asyncio-protocol.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ accept factories that return streaming protocols.
553553
a connection is open.
554554

555555
However, :meth:`protocol.eof_received() <Protocol.eof_received>`
556-
is called at most once. Once `eof_received()` is called,
556+
is called at most once. Once ``eof_received()`` is called,
557557
``data_received()`` is not called anymore.
558558

559559
.. method:: Protocol.eof_received()

Doc/library/asyncio-task.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ Timeouts
631631

632632
Change the time the timeout will trigger.
633633

634-
If *when* is `None`, any current deadline will be removed, and the
634+
If *when* is ``None``, any current deadline will be removed, and the
635635
context manager will wait indefinitely.
636636

637637
If *when* is a float, it is set as the new deadline.
@@ -867,17 +867,17 @@ Running in Threads
867867
# blocking_io complete at 19:50:54
868868
# finished main at 19:50:54
869869

870-
Directly calling `blocking_io()` in any coroutine would block the event loop
870+
Directly calling ``blocking_io()`` in any coroutine would block the event loop
871871
for its duration, resulting in an additional 1 second of run time. Instead,
872-
by using `asyncio.to_thread()`, we can run it in a separate thread without
872+
by using ``asyncio.to_thread()``, we can run it in a separate thread without
873873
blocking the event loop.
874874

875875
.. note::
876876

877-
Due to the :term:`GIL`, `asyncio.to_thread()` can typically only be used
877+
Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used
878878
to make IO-bound functions non-blocking. However, for extension modules
879879
that release the GIL or alternative Python implementations that don't
880-
have one, `asyncio.to_thread()` can also be used for CPU-bound functions.
880+
have one, ``asyncio.to_thread()`` can also be used for CPU-bound functions.
881881

882882
.. versionadded:: 3.9
883883

@@ -1144,10 +1144,8 @@ Task Object
11441144
.. versionchanged:: 3.9
11451145
Added the *msg* parameter.
11461146

1147-
.. deprecated-removed:: 3.11 3.14
1148-
*msg* parameter is ambiguous when multiple :meth:`cancel`
1149-
are called with different cancellation messages.
1150-
The argument will be removed.
1147+
.. versionchanged:: 3.11
1148+
The ``msg`` parameter is propagated from cancelled task to its awaiter.
11511149

11521150
.. _asyncio_example_task_cancel:
11531151

Doc/library/bdb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ The :mod:`bdb` module also defines two classes:
143143

144144
For real file names, the canonical form is an operating-system-dependent,
145145
:func:`case-normalized <os.path.normcase>` :func:`absolute path
146-
<os.path.abspath>`. A *filename* with angle brackets, such as `"<stdin>"`
146+
<os.path.abspath>`. A *filename* with angle brackets, such as ``"<stdin>"``
147147
generated in interactive mode, is returned unchanged.
148148

149149
.. method:: reset()

Doc/library/bz2.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Incremental (de)compression
206206
will be set to ``True``.
207207

208208
Attempting to decompress data after the end of stream is reached
209-
raises an `EOFError`. Any data found after the end of the
209+
raises an :exc:`EOFError`. Any data found after the end of the
210210
stream is ignored and saved in the :attr:`~.unused_data` attribute.
211211

212212
.. versionchanged:: 3.5
@@ -303,7 +303,7 @@ Using :class:`BZ2Compressor` for incremental compression:
303303
>>> out = out + comp.flush()
304304

305305
The example above uses a very "nonrandom" stream of data
306-
(a stream of `b"z"` chunks). Random data tends to compress poorly,
306+
(a stream of ``b"z"`` chunks). Random data tends to compress poorly,
307307
while ordered, repetitive data usually yields a high compression ratio.
308308

309309
Writing and reading a bzip2-compressed file in binary mode:

Doc/library/concurrent.futures.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ And::
152152

153153
All threads enqueued to ``ThreadPoolExecutor`` will be joined before the
154154
interpreter can exit. Note that the exit handler which does this is
155-
executed *before* any exit handlers added using `atexit`. This means
155+
executed *before* any exit handlers added using ``atexit``. This means
156156
exceptions in the main thread must be caught and handled in order to
157157
signal threads to exit gracefully. For this reason, it is recommended
158158
that ``ThreadPoolExecutor`` not be used for long-running tasks.
@@ -411,13 +411,13 @@ The :class:`Future` class encapsulates the asynchronous execution of a callable.
411411
tests.
412412

413413
If the method returns ``False`` then the :class:`Future` was cancelled,
414-
i.e. :meth:`Future.cancel` was called and returned `True`. Any threads
414+
i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads
415415
waiting on the :class:`Future` completing (i.e. through
416416
:func:`as_completed` or :func:`wait`) will be woken up.
417417

418418
If the method returns ``True`` then the :class:`Future` was not cancelled
419419
and has been put in the running state, i.e. calls to
420-
:meth:`Future.running` will return `True`.
420+
:meth:`Future.running` will return ``True``.
421421

422422
This method can only be called once and cannot be called after
423423
:meth:`Future.set_result` or :meth:`Future.set_exception` have been

Doc/library/ctypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ Utility functions
19481948
.. function:: GetLastError()
19491949

19501950
Windows only: Returns the last error code set by Windows in the calling thread.
1951-
This function calls the Windows `GetLastError()` function directly,
1951+
This function calls the Windows ``GetLastError()`` function directly,
19521952
it does not return the ctypes-private copy of the error code.
19531953

19541954
.. function:: get_errno()

Doc/library/curses.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ The module :mod:`curses` defines the following functions:
275275
Change the definition of a color, taking the number of the color to be changed
276276
followed by three RGB values (for the amounts of red, green, and blue
277277
components). The value of *color_number* must be between ``0`` and
278-
`COLORS - 1`. Each of *r*, *g*, *b*, must be a value between ``0`` and
278+
``COLORS - 1``. Each of *r*, *g*, *b*, must be a value between ``0`` and
279279
``1000``. When :func:`init_color` is used, all occurrences of that color on the
280280
screen immediately change to the new definition. This function is a no-op on
281281
most terminals; it is active only if :func:`can_change_color` returns ``True``.

Doc/library/datetime.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,7 @@ Other constructor:
17691769
ISO 8601 format, with the following exceptions:
17701770

17711771
1. Time zone offsets may have fractional seconds.
1772-
2. The leading `T`, normally required in cases where there may be ambiguity between
1772+
2. The leading ``T``, normally required in cases where there may be ambiguity between
17731773
a date and a time, is not required.
17741774
3. Fractional seconds may have any number of digits (anything beyond 6 will
17751775
be truncated).
@@ -2265,7 +2265,7 @@ where historical changes have been made to civil time.
22652265
two digits of ``offset.hours`` and ``offset.minutes`` respectively.
22662266

22672267
.. versionchanged:: 3.6
2268-
Name generated from ``offset=timedelta(0)`` is now plain `'UTC'`, not
2268+
Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not
22692269
``'UTC+00:00'``.
22702270

22712271

Doc/library/decimal.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,11 @@ Decimal objects
576576
Alternative constructor that only accepts instances of :class:`float` or
577577
:class:`int`.
578578

579-
Note `Decimal.from_float(0.1)` is not the same as `Decimal('0.1')`.
579+
Note ``Decimal.from_float(0.1)`` is not the same as ``Decimal('0.1')``.
580580
Since 0.1 is not exactly representable in binary floating point, the
581581
value is stored as the nearest representable value which is
582-
`0x1.999999999999ap-4`. That equivalent value in decimal is
583-
`0.1000000000000000055511151231257827021181583404541015625`.
582+
``0x1.999999999999ap-4``. That equivalent value in decimal is
583+
``0.1000000000000000055511151231257827021181583404541015625``.
584584

585585
.. note:: From Python 3.2 onwards, a :class:`Decimal` instance
586586
can also be constructed directly from a :class:`float`.
@@ -1209,7 +1209,7 @@ In addition to the three supplied contexts, new contexts can be created with the
12091209

12101210
.. method:: exp(x)
12111211

1212-
Returns `e ** x`.
1212+
Returns ``e ** x``.
12131213

12141214

12151215
.. method:: fma(x, y, z)

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ details of bytecode instructions as :class:`Instruction` instances:
367367

368368
.. class:: Positions
369369

370-
In case the information is not available, some fields might be `None`.
370+
In case the information is not available, some fields might be ``None``.
371371

372372
.. data:: lineno
373373
.. data:: end_lineno

Doc/library/email.compat32-message.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ Here are the methods of the :class:`Message` class:
298298
In a model generated from bytes, any header values that (in contravention of
299299
the RFCs) contain non-ASCII bytes will, when retrieved through this
300300
interface, be represented as :class:`~email.header.Header` objects with
301-
a charset of `unknown-8bit`.
301+
a charset of ``unknown-8bit``.
302302

303303

304304
.. method:: __len__()

Doc/library/email.headerregistry.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ headers.
153153
specified as ``-0000`` (indicating it is in UTC but contains no
154154
information about the source timezone), then :attr:`.datetime` will be a
155155
naive :class:`~datetime.datetime`. If a specific timezone offset is
156-
found (including `+0000`), then :attr:`.datetime` will contain an aware
156+
found (including ``+0000``), then :attr:`.datetime` will contain an aware
157157
``datetime`` that uses :class:`datetime.timezone` to record the timezone
158158
offset.
159159

Doc/library/fractions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ another rational number, or from a string.
9999
``typing.SupportsInt`` instance checks.
100100

101101
.. versionchanged:: 3.12
102-
Space is allowed around the slash for string inputs: `Fraction('2 / 3')`.
102+
Space is allowed around the slash for string inputs: ``Fraction('2 / 3')``.
103103

104104
.. attribute:: numerator
105105

Doc/library/hashlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ Constructor functions also accept the following tree hashing parameters:
426426
BLAKE2s, 0 in sequential mode).
427427

428428
* *last_node*: boolean indicating whether the processed node is the last
429-
one (`False` for sequential mode).
429+
one (``False`` for sequential mode).
430430

431431
.. figure:: hashlib-blake2-tree.png
432432
:alt: Explanation of tree mode parameters.

Doc/library/importlib.rst

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ ABC hierarchy::
443443
from the import. If the loader inserted a module and the load fails, it
444444
must be removed by the loader from :data:`sys.modules`; modules already
445445
in :data:`sys.modules` before the loader began execution should be left
446-
alone (see :func:`importlib.util.module_for_loader`).
446+
alone.
447447

448448
The loader should set several attributes on the module
449449
(note that some of these attributes can change when a module is
@@ -1326,58 +1326,6 @@ an :term:`importer`.
13261326

13271327
.. versionadded:: 3.5
13281328

1329-
.. decorator:: module_for_loader
1330-
1331-
A :term:`decorator` for :meth:`importlib.abc.Loader.load_module`
1332-
to handle selecting the proper
1333-
module object to load with. The decorated method is expected to have a call
1334-
signature taking two positional arguments
1335-
(e.g. ``load_module(self, module)``) for which the second argument
1336-
will be the module **object** to be used by the loader.
1337-
Note that the decorator will not work on static methods because of the
1338-
assumption of two arguments.
1339-
1340-
The decorated method will take in the **name** of the module to be loaded
1341-
as expected for a :term:`loader`. If the module is not found in
1342-
:data:`sys.modules` then a new one is constructed. Regardless of where the
1343-
module came from, :attr:`__loader__` set to **self** and :attr:`__package__`
1344-
is set based on what :meth:`importlib.abc.InspectLoader.is_package` returns
1345-
(if available). These attributes are set unconditionally to support
1346-
reloading.
1347-
1348-
If an exception is raised by the decorated method and a module was added to
1349-
:data:`sys.modules`, then the module will be removed to prevent a partially
1350-
initialized module from being in left in :data:`sys.modules`. If the module
1351-
was already in :data:`sys.modules` then it is left alone.
1352-
1353-
.. versionchanged:: 3.3
1354-
:attr:`__loader__` and :attr:`__package__` are automatically set
1355-
(when possible).
1356-
1357-
.. versionchanged:: 3.4
1358-
Set :attr:`__name__`, :attr:`__loader__` :attr:`__package__`
1359-
unconditionally to support reloading.
1360-
1361-
.. deprecated:: 3.4
1362-
The import machinery now directly performs all the functionality
1363-
provided by this function.
1364-
1365-
.. decorator:: set_loader
1366-
1367-
A :term:`decorator` for :meth:`importlib.abc.Loader.load_module`
1368-
to set the :attr:`__loader__`
1369-
attribute on the returned module. If the attribute is already set the
1370-
decorator does nothing. It is assumed that the first positional argument to
1371-
the wrapped method (i.e. ``self``) is what :attr:`__loader__` should be set
1372-
to.
1373-
1374-
.. versionchanged:: 3.4
1375-
Set ``__loader__`` if set to ``None``, as if the attribute does not
1376-
exist.
1377-
1378-
.. deprecated:: 3.4
1379-
The import machinery takes care of this automatically.
1380-
13811329
.. function:: spec_from_loader(name, loader, *, origin=None, is_package=None)
13821330

13831331
A factory function for creating a :class:`~importlib.machinery.ModuleSpec`

0 commit comments

Comments
 (0)