]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use roles :data: and :const: for referencing module variables (GH-129507)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 4 Feb 2025 14:16:41 +0000 (16:16 +0200)
committerGitHub <noreply@github.com>
Tue, 4 Feb 2025 14:16:41 +0000 (16:16 +0200)
19 files changed:
Doc/howto/free-threading-python.rst
Doc/library/datetime.rst
Doc/library/decimal.rst
Doc/library/filecmp.rst
Doc/library/importlib.metadata.rst
Doc/library/importlib.rst
Doc/library/logging.rst
Doc/library/plistlib.rst
Doc/library/select.rst
Doc/library/site.rst
Doc/library/ssl.rst
Doc/whatsnew/2.3.rst
Doc/whatsnew/2.7.rst
Doc/whatsnew/3.12.rst
Doc/whatsnew/3.13.rst
Doc/whatsnew/3.4.rst
Misc/NEWS.d/3.11.0a4.rst
Misc/NEWS.d/3.14.0a1.rst
Misc/NEWS.d/next/Library/2024-12-16-22-20-38.gh-issue-121604.m3Xn4G.rst

index b21e3287ecaa3f58b397af2e08de4f1f59e00790..cd920553a3a461f5c5a17e03d0f7abf1fb7d3b80 100644 (file)
@@ -43,7 +43,7 @@ Identifying free-threaded Python
 ================================
 
 To check if the current interpreter supports free-threading, :option:`python -VV <-V>`
-and :attr:`sys.version` contain "experimental free-threading build".
+and :data:`sys.version` contain "experimental free-threading build".
 The new :func:`sys._is_gil_enabled` function can be used to check whether
 the GIL is actually disabled in the running process.
 
index 2f81080d525f86624095b083b9ce93c0294e1de4..1af7d6be750102dd00d005cff52e51e07a53096c 100644 (file)
@@ -93,7 +93,7 @@ The :mod:`!datetime` module exports the following constants:
    The largest year number allowed in a :class:`date` or :class:`.datetime` object.
    :const:`MAXYEAR` is 9999.
 
-.. attribute:: UTC
+.. data:: UTC
 
    Alias for the UTC time zone singleton :attr:`datetime.timezone.utc`.
 
@@ -970,7 +970,7 @@ Other constructors, all class methods:
 
    .. deprecated:: 3.12
 
-      Use :meth:`datetime.now` with :attr:`UTC` instead.
+      Use :meth:`datetime.now` with :const:`UTC` instead.
 
 
 .. classmethod:: datetime.fromtimestamp(timestamp, tz=None)
@@ -1042,7 +1042,7 @@ Other constructors, all class methods:
 
    .. deprecated:: 3.12
 
-      Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead.
+      Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead.
 
 
 .. classmethod:: datetime.fromordinal(ordinal)
index 185eaf3f721c72160b3f0f4c6da88b15e89ba3a2..9318af60b60f9500100ecccfbbb301443e33bb7e 100644 (file)
@@ -2262,7 +2262,7 @@ value for :attr:`~Context.prec` as well [#]_::
     Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')
 
 
-For inexact results, :attr:`MAX_PREC` is far too large on 64-bit platforms and
+For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms and
 the available memory will be insufficient::
 
    >>> Decimal(1) / 3
index 282d0e0d8db5cfd9694ba824821c5918e3080a0a..abd1b8c826d1705ef35c9297500ada55e929623b 100644 (file)
@@ -189,7 +189,7 @@ The :class:`dircmp` class
          are the same type as *self*, if *self* is a subclass of
          :class:`dircmp`.
 
-.. attribute:: DEFAULT_IGNORES
+.. data:: DEFAULT_IGNORES
 
    .. versionadded:: 3.4
 
index d80255f5313061d74a5056b2825a738d64697793..45bf19ec29286d21b067e30e11ac6ca9d45a4159 100644 (file)
@@ -375,7 +375,7 @@ Mapping import to distribution packages
 .. function:: packages_distributions()
 
    Return a mapping from the top level module and import package
-   names found via :attr:`sys.meta_path` to the names of the distribution
+   names found via :data:`sys.meta_path` to the names of the distribution
    packages (if any) that provide the corresponding files.
 
    To allow for namespace packages (which may have members provided by
index b935fc0e42a4bd4c9b155c9cb56293a85b470f7e..245807e55ec93620befc2b79b854b6df2c6c3e8a 100644 (file)
@@ -746,7 +746,7 @@ ABC hierarchy::
        suitable for reading (same as :attr:`pathlib.Path.open`).
 
        When opening as text, accepts encoding parameters such as those
-       accepted by :attr:`io.TextIOWrapper`.
+       accepted by :class:`io.TextIOWrapper`.
 
     .. method:: read_bytes()
 
@@ -794,14 +794,14 @@ ABC hierarchy::
 This module contains the various objects that help :keyword:`import`
 find and load modules.
 
-.. attribute:: SOURCE_SUFFIXES
+.. data:: SOURCE_SUFFIXES
 
    A list of strings representing the recognized file suffixes for source
    modules.
 
    .. versionadded:: 3.3
 
-.. attribute:: DEBUG_BYTECODE_SUFFIXES
+.. data:: DEBUG_BYTECODE_SUFFIXES
 
    A list of strings representing the file suffixes for non-optimized bytecode
    modules.
@@ -809,9 +809,9 @@ find and load modules.
    .. versionadded:: 3.3
 
    .. deprecated:: 3.5
-      Use :attr:`BYTECODE_SUFFIXES` instead.
+      Use :const:`BYTECODE_SUFFIXES` instead.
 
-.. attribute:: OPTIMIZED_BYTECODE_SUFFIXES
+.. data:: OPTIMIZED_BYTECODE_SUFFIXES
 
    A list of strings representing the file suffixes for optimized bytecode
    modules.
@@ -819,9 +819,9 @@ find and load modules.
    .. versionadded:: 3.3
 
    .. deprecated:: 3.5
-      Use :attr:`BYTECODE_SUFFIXES` instead.
+      Use :const:`BYTECODE_SUFFIXES` instead.
 
-.. attribute:: BYTECODE_SUFFIXES
+.. data:: BYTECODE_SUFFIXES
 
    A list of strings representing the recognized file suffixes for bytecode
    modules (including the leading dot).
@@ -831,7 +831,7 @@ find and load modules.
    .. versionchanged:: 3.5
       The value is no longer dependent on ``__debug__``.
 
-.. attribute:: EXTENSION_SUFFIXES
+.. data:: EXTENSION_SUFFIXES
 
    A list of strings representing the recognized file suffixes for
    extension modules.
@@ -1109,7 +1109,7 @@ find and load modules.
    .. method:: is_package(fullname)
 
       Returns ``True`` if the file path points to a package's ``__init__``
-      module based on :attr:`EXTENSION_SUFFIXES`.
+      module based on :const:`EXTENSION_SUFFIXES`.
 
    .. method:: get_code(fullname)
 
@@ -1294,7 +1294,7 @@ find and load modules.
 This module contains the various objects that help in the construction of
 an :term:`importer`.
 
-.. attribute:: MAGIC_NUMBER
+.. data:: MAGIC_NUMBER
 
    The bytes which represent the bytecode version number. If you need help with
    loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`.
index 235bcc281ac8f8b2eb73b7d52323667bbad7e81f..19ae024f9eeffaf71eb854afbd5baf67b540d056 100644 (file)
@@ -342,7 +342,7 @@ in a module, ``__name__`` is the module's name in the Python package namespace.
 
       If no handler is attached to this logger (or any of its ancestors,
       taking into account the relevant :attr:`Logger.propagate` attributes),
-      the message will be sent to the handler set on :attr:`lastResort`.
+      the message will be sent to the handler set on :data:`lastResort`.
 
       .. versionchanged:: 3.2
          The *stack_info* parameter was added.
@@ -1495,7 +1495,7 @@ functions.
 Module-Level Attributes
 -----------------------
 
-.. attribute:: lastResort
+.. data:: lastResort
 
    A "handler of last resort" is available through this attribute. This
    is a :class:`StreamHandler` writing to ``sys.stderr`` with a level of
@@ -1507,7 +1507,7 @@ Module-Level Attributes
 
    .. versionadded:: 3.2
 
-.. attribute:: raiseExceptions
+.. data:: raiseExceptions
 
    Used to see if exceptions during handling should be propagated.
 
index 2906ebe7822f525e4d6f774dd3cad9b2b36bd9fc..075b974501e3daa2b8173329056b5465c0a135a3 100644 (file)
@@ -71,7 +71,7 @@ This module defines the following functions:
 
    When *aware_datetime* is true, fields with type ``datetime.datetime`` will
    be created as :ref:`aware object <datetime-naive-aware>`, with
-   :attr:`!tzinfo` as :attr:`datetime.UTC`.
+   :attr:`!tzinfo` as :const:`datetime.UTC`.
 
    XML data for the :data:`FMT_XML` format is parsed using the Expat parser
    from :mod:`xml.parsers.expat` -- see its documentation for possible
index 457970aed2dc73c31f05ce2c823a772bcbb6c54d..d2094283d5473615952a68d97a614d8307030d08 100644 (file)
@@ -165,7 +165,7 @@ The module defines the following:
       :exc:`InterruptedError`.
 
 
-.. attribute:: PIPE_BUF
+.. data:: PIPE_BUF
 
    The minimum number of bytes which can be written without blocking to a pipe
    when the pipe has been reported as ready for writing by :func:`~select.select`,
index 5f2a0f610e1aa54afca0bcb6c85192da601b5a9e..e98dd83b60eb6009769cf850ad663c880e674ada 100644 (file)
@@ -35,7 +35,7 @@ are skipped.  For the tail part, it uses the empty string and then
 :file:`lib/site-packages` (on Windows) or
 :file:`lib/python{X.Y[t]}/site-packages` (on Unix and macOS). (The
 optional suffix "t" indicates the :term:`free threading` build, and is
-appended if ``"t"`` is present in the :attr:`sys.abiflags` constant.)
+appended if ``"t"`` is present in the :data:`sys.abiflags` constant.)
 For each
 of the distinct head-tail combinations, it sees if it refers to an existing
 directory, and if so, adds it to ``sys.path`` and also inspects the newly
index 37ea32dc8a56e5ae2a643095ed048896ef98561d..c0dcecf737ef7650df2ef8bd4285c24a1805b4e6 100644 (file)
@@ -1937,8 +1937,8 @@ to speed up repeated connections from the same clients.
 
    A :class:`TLSVersion` enum member representing the highest supported
    TLS version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`.
-   The attribute is read-only for protocols other than :attr:`PROTOCOL_TLS`,
-   :attr:`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`.
+   The attribute is read-only for protocols other than :const:`PROTOCOL_TLS`,
+   :const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`.
 
    The attributes :attr:`~SSLContext.maximum_version`,
    :attr:`~SSLContext.minimum_version` and
@@ -1961,7 +1961,7 @@ to speed up repeated connections from the same clients.
 .. attribute:: SSLContext.num_tickets
 
    Control the number of TLS 1.3 session tickets of a
-   :attr:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS
+   :const:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS
    1.0 to 1.2 connections.
 
    .. versionadded:: 3.8
index ac463f82cfb8ca8b794c0b709e28d153c2c79f39..b7e4e73f4ce4aa03beeb96605f9b2818842368c4 100644 (file)
@@ -353,7 +353,7 @@ convert them to Unicode using the ``mbcs`` encoding.
 Other systems also allow Unicode strings as file names but convert them to byte
 strings before passing them to the system, which can cause a :exc:`UnicodeError`
 to be raised. Applications can test whether arbitrary Unicode strings are
-supported as file names by checking :attr:`os.path.supports_unicode_filenames`,
+supported as file names by checking :const:`os.path.supports_unicode_filenames`,
 a Boolean value.
 
 Under MacOS, :func:`os.listdir` may now return Unicode filenames.
index 0e4dee0bd24fb28ef661231982bfb89dd493343c..caed3192be871deea7f4d9176e1bc87c9242d0bb 100644 (file)
@@ -1602,7 +1602,7 @@ changes, or look through the Subversion logs for all the details.
   identifier instead of the previous default value of ``'python'``.
   (Changed by Sean Reifschneider; :issue:`8451`.)
 
-* The :attr:`sys.version_info` value is now a named tuple, with attributes
+* The :data:`sys.version_info` value is now a named tuple, with attributes
   named :attr:`!major`, :attr:`!minor`, :attr:`!micro`,
   :attr:`!releaselevel`, and :attr:`!serial`.  (Contributed by Ross
   Light; :issue:`4285`.)
index 4fffc78a2377914b053e795a5071288a4368a4f6..994ccc708e26f2319f559654bba8641085eae3e3 100644 (file)
@@ -1467,8 +1467,8 @@ imp
     ``imp.NullImporter``               Insert ``None`` into ``sys.path_importer_cache``
     ``imp.cache_from_source()``        :func:`importlib.util.cache_from_source`
     ``imp.find_module()``              :func:`importlib.util.find_spec`
-    ``imp.get_magic()``                :attr:`importlib.util.MAGIC_NUMBER`
-    ``imp.get_suffixes()``             :attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery.EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`
+    ``imp.get_magic()``                :const:`importlib.util.MAGIC_NUMBER`
+    ``imp.get_suffixes()``             :const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`
     ``imp.get_tag()``                  :attr:`sys.implementation.cache_tag <sys.implementation>`
     ``imp.load_module()``              :func:`importlib.import_module`
     ``imp.new_module(name)``           ``types.ModuleType(name)``
index f2a8c711f4df886f8a9a63d7633d2e045a06ebda..2090759d3c4fde1ac6dbc740e861c7baa5f3de75 100644 (file)
@@ -325,7 +325,7 @@ enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or
 the command-line option :option:`-X gil=1`.
 
 To check if the current interpreter supports free-threading, :option:`python -VV <-V>`
-and :attr:`sys.version` contain "experimental free-threading build".
+and :data:`sys.version` contain "experimental free-threading build".
 The new :func:`!sys._is_gil_enabled` function can be used to check whether
 the GIL is actually disabled in the running process.
 
@@ -1062,7 +1062,7 @@ os
   which makes the newly spawned process use the current process environment.
   (Contributed by Jakub Kulik in :gh:`113119`.)
 
-* :func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM`
+* :func:`~os.posix_spawn` can now use the :const:`~os.POSIX_SPAWN_CLOSEFROM`
   attribute in the *file_actions* parameter on platforms that support
   :c:func:`!posix_spawn_file_actions_addclosefrom_np`.
   (Contributed by Jakub Kulik in :gh:`113117`.)
index 71b186aeed7359d53985151f769ba37d4473bd56..e4f602a17ee96875efc075c2a92d14b1ffd0eca2 100644 (file)
@@ -994,7 +994,7 @@ The :func:`~importlib.reload` function has been moved from :mod:`!imp` to
 :mod:`importlib` as part of the :mod:`!imp` module deprecation.  (Contributed by
 Berker Peksag in :issue:`18193`.)
 
-:mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` attribute
+:mod:`importlib.util` now has a :const:`~importlib.util.MAGIC_NUMBER` attribute
 providing access to the bytecode version number.  This replaces the
 :func:`!get_magic` function in the deprecated :mod:`!imp` module.
 (Contributed by Brett Cannon in :issue:`18192`.)
index 64e2f39ad9db18ccc21bc02e2a48c607b114dac5..a2d3620204588745bbdf59773f07898d79690fe8 100644 (file)
@@ -775,8 +775,8 @@ Ensure that :func:`math.expm1` does not raise on underflow.
 .. nonce: s9PuyF
 .. section: Library
 
-Adding :attr:`F_DUP2FD` and :attr:`F_DUP2FD_CLOEXEC` constants from FreeBSD
-into the fcntl module.
+Adding :const:`!F_DUP2FD` and :const:`!F_DUP2FD_CLOEXEC` constants from FreeBSD
+into the :mod:`fcntl` module.
 
 ..
 
index dfc338126111856fd706da3c16b039dc280abf23..efeba0ac1ffe2f5b72eb60564af8ae6c8de35d4c 100644 (file)
@@ -798,7 +798,7 @@ when used with ``happy_eyeballs_delay``
 
 Fixed :exc:`AssertionError` when using
 :func:`!asyncio.staggered.staggered_race` with
-:attr:`asyncio.eager_task_factory`.
+:data:`asyncio.eager_task_factory`.
 
 ..
 
@@ -1755,8 +1755,8 @@ Adjust ``cmath.tanh(nanj)`` and ``cmath.tanh(infj)`` for recent C standards.
 Remove internal frames from tracebacks shown in
 :class:`code.InteractiveInterpreter` with non-default
 :func:`sys.excepthook`. Save correct tracebacks in
-:attr:`sys.last_traceback` and update ``__traceback__`` attribute of
-:attr:`sys.last_value` and :attr:`sys.last_exc`.
+:data:`sys.last_traceback` and update ``__traceback__`` attribute of
+:data:`sys.last_value` and :data:`sys.last_exc`.
 
 ..
 
index 9a6fce8647cc6bf44db6caef0c39d40123cdb93c..8edd8dfb60487841ac961808949d2b59b53bf319 100644 (file)
@@ -1 +1 @@
-Add missing Deprecation warnings for :attr:`importlib.machinery.DEBUG_BYTECODE_SUFFIXES`, :attr:`importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES`, :class:`importlib.machinery.WindowsRegistryFinder`, :class:`importlib.abc.ResourceLoader`, :meth:`importlib.abc.SourceLoader.path_mtime`.
+Add missing Deprecation warnings for :const:`importlib.machinery.DEBUG_BYTECODE_SUFFIXES`, :const:`importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES`, :class:`importlib.machinery.WindowsRegistryFinder`, :class:`importlib.abc.ResourceLoader`, :meth:`importlib.abc.SourceLoader.path_mtime`.