[Python-checkins] gh-106892: Use roles :data: and :const: for referencing module variables (GH-106894)

serhiy-storchaka webhook-mailer at python.org
Fri Jul 21 05:34:34 EDT 2023


https://github.com/python/cpython/commit/d036db728ea3d54509cbad06df74e2d9a31fbec8
commit: d036db728ea3d54509cbad06df74e2d9a31fbec8
branch: main
author: Serhiy Storchaka <storchaka at gmail.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2023-07-21T12:34:30+03:00
summary:

gh-106892: Use roles :data: and :const: for referencing module variables (GH-106894)

files:
M Doc/c-api/import.rst
M Doc/library/__main__.rst
M Doc/library/asyncio-subprocess.rst
M Doc/library/compileall.rst
M Doc/library/devmode.rst
M Doc/library/filecmp.rst
M Doc/library/ftplib.rst
M Doc/library/functions.rst
M Doc/library/gc.rst
M Doc/library/gzip.rst
M Doc/library/importlib.resources.abc.rst
M Doc/library/importlib.rst
M Doc/library/json.rst
M Doc/library/logging.handlers.rst
M Doc/library/os.path.rst
M Doc/library/os.rst
M Doc/library/platform.rst
M Doc/library/shutil.rst
M Doc/library/stdtypes.rst
M Doc/library/subprocess.rst
M Doc/library/sys.rst
M Doc/library/tarfile.rst
M Doc/library/test.rst
M Doc/library/tkinter.rst
M Doc/library/unittest.rst
M Doc/reference/datamodel.rst
M Doc/using/windows.rst
M Doc/whatsnew/2.5.rst
M Doc/whatsnew/3.1.rst
M Doc/whatsnew/3.11.rst
M Doc/whatsnew/3.12.rst
M Doc/whatsnew/3.2.rst
M Doc/whatsnew/3.3.rst
M Doc/whatsnew/3.4.rst
M Doc/whatsnew/3.6.rst
M Doc/whatsnew/3.8.rst
M Doc/whatsnew/3.9.rst
M Misc/NEWS.d/3.12.0a1.rst
M Misc/NEWS.d/3.8.0a4.rst
M Misc/NEWS.d/3.9.0a5.rst

diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
index 7aacc219a2bd6..f9c2f4e69ce88 100644
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -142,9 +142,9 @@ Importing Modules
    read from a Python bytecode file or obtained from the built-in function
    :func:`compile`, load the module.  Return a new reference to the module object,
    or ``NULL`` with an exception set if an error occurred.  *name*
-   is removed from :attr:`sys.modules` in error cases, even if *name* was already
-   in :attr:`sys.modules` on entry to :c:func:`PyImport_ExecCodeModule`.  Leaving
-   incompletely initialized modules in :attr:`sys.modules` is dangerous, as imports of
+   is removed from :data:`sys.modules` in error cases, even if *name* was already
+   in :data:`sys.modules` on entry to :c:func:`PyImport_ExecCodeModule`.  Leaving
+   incompletely initialized modules in :data:`sys.modules` is dangerous, as imports of
    such modules have no way to know that the module object is an unknown (and
    probably damaged with respect to the module author's intents) state.
 
diff --git a/Doc/library/__main__.rst b/Doc/library/__main__.rst
index d29cbdff7830c..fd60d92d4eb0f 100644
--- a/Doc/library/__main__.rst
+++ b/Doc/library/__main__.rst
@@ -336,12 +336,12 @@ Note that importing ``__main__`` doesn't cause any issues with unintentionally
 running top-level code meant for script use which is put in the
 ``if __name__ == "__main__"`` block of the ``start`` module. Why does this work?
 
-Python inserts an empty ``__main__`` module in :attr:`sys.modules` at
+Python inserts an empty ``__main__`` module in :data:`sys.modules` at
 interpreter startup, and populates it by running top-level code. In our example
 this is the ``start`` module which runs line by line and imports ``namely``.
 In turn, ``namely`` imports ``__main__`` (which is really ``start``). That's an
 import cycle! Fortunately, since the partially populated ``__main__``
-module is present in :attr:`sys.modules`, Python passes that to ``namely``.
+module is present in :data:`sys.modules`, Python passes that to ``namely``.
 See :ref:`Special considerations for __main__ <import-dunder-main>` in the
 import system's reference for details on how this works.
 
diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst
index b7c83aa04c09f..464a8d6fe7d96 100644
--- a/Doc/library/asyncio-subprocess.rst
+++ b/Doc/library/asyncio-subprocess.rst
@@ -68,7 +68,7 @@ Creating Subprocesses
 
    The *limit* argument sets the buffer limit for :class:`StreamReader`
    wrappers for :attr:`Process.stdout` and :attr:`Process.stderr`
-   (if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
+   (if :const:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
 
    Return a :class:`~asyncio.subprocess.Process` instance.
 
@@ -86,7 +86,7 @@ Creating Subprocesses
 
    The *limit* argument sets the buffer limit for :class:`StreamReader`
    wrappers for :attr:`Process.stdout` and :attr:`Process.stderr`
-   (if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
+   (if :const:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
 
    Return a :class:`~asyncio.subprocess.Process` instance.
 
diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst
index 180f5b81c2b61..4226348a17240 100644
--- a/Doc/library/compileall.rst
+++ b/Doc/library/compileall.rst
@@ -141,9 +141,9 @@ There is no command-line option to control the optimization level used by the
 :func:`compile` function, because the Python interpreter itself already
 provides the option: :program:`python -O -m compileall`.
 
-Similarly, the :func:`compile` function respects the :attr:`sys.pycache_prefix`
+Similarly, the :func:`compile` function respects the :data:`sys.pycache_prefix`
 setting. The generated bytecode cache will only be useful if :func:`compile` is
-run with the same :attr:`sys.pycache_prefix` (if any) that will be used at
+run with the same :data:`sys.pycache_prefix` (if any) that will be used at
 runtime.
 
 Public functions
diff --git a/Doc/library/devmode.rst b/Doc/library/devmode.rst
index 80ac13b116c1d..914aa45cf9cbc 100644
--- a/Doc/library/devmode.rst
+++ b/Doc/library/devmode.rst
@@ -81,7 +81,7 @@ Effects of the Python Development Mode:
   ignored for empty strings.
 
 * The :class:`io.IOBase` destructor logs ``close()`` exceptions.
-* Set the :attr:`~sys.flags.dev_mode` attribute of :attr:`sys.flags` to
+* Set the :attr:`~sys.flags.dev_mode` attribute of :data:`sys.flags` to
   ``True``.
 
 The Python Development Mode does not enable the :mod:`tracemalloc` module by
diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst
index 83e9e14ddcacd..0efb4897a1eb8 100644
--- a/Doc/library/filecmp.rst
+++ b/Doc/library/filecmp.rst
@@ -74,7 +74,7 @@ The :class:`dircmp` class
 
    Construct a new directory comparison object, to compare the directories *a*
    and *b*.  *ignore* is a list of names to ignore, and defaults to
-   :attr:`filecmp.DEFAULT_IGNORES`.  *hide* is a list of names to hide, and
+   :const:`filecmp.DEFAULT_IGNORES`.  *hide* is a list of names to hide, and
    defaults to ``[os.curdir, os.pardir]``.
 
    The :class:`dircmp` class compares files by doing *shallow* comparisons
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
index e7fb5b1ae2696..b90ead91933ab 100644
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -431,7 +431,7 @@ FTP_TLS Objects
 
 .. attribute:: FTP_TLS.ssl_version
 
-   The SSL version to use (defaults to :attr:`ssl.PROTOCOL_SSLv23`).
+   The SSL version to use (defaults to :data:`ssl.PROTOCOL_SSLv23`).
 
 .. method:: FTP_TLS.auth()
 
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index d8091f0b093aa..2688f43f9b4ff 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1231,7 +1231,7 @@ are always available.  They are listed here in alphabetical order.
 
    * Binary files are buffered in fixed-size chunks; the size of the buffer is
      chosen using a heuristic trying to determine the underlying device's "block
-     size" and falling back on :attr:`io.DEFAULT_BUFFER_SIZE`.  On many systems,
+     size" and falling back on :const:`io.DEFAULT_BUFFER_SIZE`.  On many systems,
      the buffer will typically be 4096 or 8192 bytes long.
 
    * "Interactive" text files (files for which :meth:`~io.IOBase.isatty`
diff --git a/Doc/library/gc.rst b/Doc/library/gc.rst
index 0961ca4aaa942..331c071cda769 100644
--- a/Doc/library/gc.rst
+++ b/Doc/library/gc.rst
@@ -260,7 +260,7 @@ values but should not rebind them):
 
    .. versionchanged:: 3.4
       Following :pep:`442`, objects with a :meth:`~object.__del__` method don't end
-      up in :attr:`gc.garbage` anymore.
+      up in :data:`gc.garbage` anymore.
 
 .. data:: callbacks
 
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst
index 06cbd2567a0bc..979b39a3a5abb 100644
--- a/Doc/library/gzip.rst
+++ b/Doc/library/gzip.rst
@@ -268,7 +268,7 @@ Command line options
 
 .. cmdoption:: file
 
-   If *file* is not specified, read from :attr:`sys.stdin`.
+   If *file* is not specified, read from :data:`sys.stdin`.
 
 .. cmdoption:: --fast
 
diff --git a/Doc/library/importlib.resources.abc.rst b/Doc/library/importlib.resources.abc.rst
index 2d0f137ffc799..b0e75737137f2 100644
--- a/Doc/library/importlib.resources.abc.rst
+++ b/Doc/library/importlib.resources.abc.rst
@@ -130,7 +130,7 @@
        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()
 
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 65aaad0df9ee6..a14e5a1a1a350 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -372,7 +372,7 @@ ABC hierarchy::
             The list of locations where the package's submodules will be found.
             Most of the time this is a single directory.
             The import system passes this attribute to ``__import__()`` and to finders
-            in the same way as :attr:`sys.path` but just for the package.
+            in the same way as :data:`sys.path` but just for the package.
             It is not set on non-package modules so it can be used
             as an indicator that the module is a package.
 
@@ -609,7 +609,7 @@ ABC hierarchy::
         automatically.
 
         When writing to the path fails because the path is read-only
-        (:attr:`errno.EACCES`/:exc:`PermissionError`), do not propagate the
+        (:const:`errno.EACCES`/:exc:`PermissionError`), do not propagate the
         exception.
 
         .. versionchanged:: 3.4
@@ -843,7 +843,7 @@ find and load modules.
 
    .. classmethod:: path_hook(*loader_details)
 
-      A class method which returns a closure for use on :attr:`sys.path_hooks`.
+      A class method which returns a closure for use on :data:`sys.path_hooks`.
       An instance of :class:`FileFinder` is returned by the closure using the
       path argument given to the closure directly and *loader_details*
       indirectly.
@@ -1184,10 +1184,10 @@ an :term:`importer`.
 .. function:: find_spec(name, package=None)
 
    Find the :term:`spec <module spec>` for a module, optionally relative to
-   the specified **package** name. If the module is in :attr:`sys.modules`,
+   the specified **package** name. If the module is in :data:`sys.modules`,
    then ``sys.modules[name].__spec__`` is returned (unless the spec would be
    ``None`` or is not set, in which case :exc:`ValueError` is raised).
-   Otherwise a search using :attr:`sys.meta_path` is done. ``None`` is
+   Otherwise a search using :data:`sys.meta_path` is done. ``None`` is
    returned if no spec is found.
 
    If **name** is for a submodule (contains a dot), the parent module is
@@ -1259,7 +1259,7 @@ an :term:`importer`.
    :meth:`~importlib.abc.Loader.create_module` method must return ``None`` or a
    type for which its ``__class__`` attribute can be mutated along with not
    using :term:`slots <__slots__>`. Finally, modules which substitute the object
-   placed into :attr:`sys.modules` will not work as there is no way to properly
+   placed into :data:`sys.modules` will not work as there is no way to properly
    replace the module references throughout the interpreter safely;
    :exc:`ValueError` is raised if such a substitution is detected.
 
@@ -1383,9 +1383,9 @@ For deep customizations of import, you typically want to implement an
 :term:`importer`. This means managing both the :term:`finder` and :term:`loader`
 side of things. For finders there are two flavours to choose from depending on
 your needs: a :term:`meta path finder` or a :term:`path entry finder`. The
-former is what you would put on :attr:`sys.meta_path` while the latter is what
-you create using a :term:`path entry hook` on :attr:`sys.path_hooks` which works
-with :attr:`sys.path` entries to potentially create a finder. This example will
+former is what you would put on :data:`sys.meta_path` while the latter is what
+you create using a :term:`path entry hook` on :data:`sys.path_hooks` which works
+with :data:`sys.path` entries to potentially create a finder. This example will
 show you how to register your own importers so that import will use them (for
 creating an importer for yourself, read the documentation for the appropriate
 classes defined within this package)::
diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index 5383614575c21..35a08995487c1 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -683,7 +683,7 @@ The :mod:`json.tool` module provides a simple command line interface to validate
 and pretty-print JSON objects.
 
 If the optional ``infile`` and ``outfile`` arguments are not
-specified, :attr:`sys.stdin` and :attr:`sys.stdout` will be used respectively:
+specified, :data:`sys.stdin` and :data:`sys.stdout` will be used respectively:
 
 .. code-block:: shell-session
 
@@ -721,12 +721,12 @@ Command line options
           }
       ]
 
-   If *infile* is not specified, read from :attr:`sys.stdin`.
+   If *infile* is not specified, read from :data:`sys.stdin`.
 
 .. cmdoption:: outfile
 
    Write the output of the *infile* to the given *outfile*. Otherwise, write it
-   to :attr:`sys.stdout`.
+   to :data:`sys.stdout`.
 
 .. cmdoption:: --sort-keys
 
diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst
index d4429d3d0a4f7..47bfe4ff7f90e 100644
--- a/Doc/library/logging.handlers.rst
+++ b/Doc/library/logging.handlers.rst
@@ -1051,8 +1051,8 @@ possible, while any potentially slow operations (such as sending an email via
       occur (e.g. because a bounded queue has filled up), the
       :meth:`~logging.Handler.handleError` method is called to handle the
       error. This can result in the record silently being dropped (if
-      :attr:`logging.raiseExceptions` is ``False``) or a message printed to
-      ``sys.stderr`` (if :attr:`logging.raiseExceptions` is ``True``).
+      :data:`logging.raiseExceptions` is ``False``) or a message printed to
+      ``sys.stderr`` (if :data:`logging.raiseExceptions` is ``True``).
 
    .. method:: prepare(record)
 
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
index 3a668e28f2e26..6f9e0853bc894 100644
--- a/Doc/library/os.path.rst
+++ b/Doc/library/os.path.rst
@@ -410,7 +410,7 @@ the :mod:`glob` module.)
    *start*.  On Windows, :exc:`ValueError` is raised when *path* and *start*
    are on different drives.
 
-   *start* defaults to :attr:`os.curdir`.
+   *start* defaults to :data:`os.curdir`.
 
    .. availability:: Unix, Windows.
 
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index b35010498f214..43c8f50e3c186 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -60,7 +60,7 @@ Notes on the availability of these functions:
    ``'java'``.
 
    .. seealso::
-      :attr:`sys.platform` has a finer granularity.  :func:`os.uname` gives
+      :data:`sys.platform` has a finer granularity.  :func:`os.uname` gives
       system-dependent version information.
 
       The :mod:`platform` module provides detailed checks for the
diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst
index 69c4dfc422c98..ec2a7ebd5d6e0 100644
--- a/Doc/library/platform.rst
+++ b/Doc/library/platform.rst
@@ -46,7 +46,7 @@ Cross Platform
       universal files containing multiple architectures.
 
       To get at the "64-bitness" of the current interpreter, it is more
-      reliable to query the :attr:`sys.maxsize` attribute::
+      reliable to query the :data:`sys.maxsize` attribute::
 
          is_64bits = sys.maxsize > 2**32
 
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index 7f408be233682..5bd80b10a6580 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -431,7 +431,7 @@ Directory and files operations
    determining if the file exists and executable.
 
    When no *path* is specified, the results of :func:`os.environ` are used,
-   returning either the "PATH" value or a fallback of :attr:`os.defpath`.
+   returning either the "PATH" value or a fallback of :data:`os.defpath`.
 
    On Windows, the current directory is prepended to the *path* if *mode* does
    not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index fd51b1187576b..26266b9eb28b8 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -5632,7 +5632,7 @@ From code, you can inspect the current limit and set a new one using these
   a getter and setter for the interpreter-wide limit. Subinterpreters have
   their own limit.
 
-Information about the default and minimum can be found in :attr:`sys.int_info`:
+Information about the default and minimum can be found in :data:`sys.int_info`:
 
 * :data:`sys.int_info.default_max_str_digits <sys.int_info>` is the compiled-in
   default limit.
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index 738e611c05adb..db05cb294d93f 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -1610,7 +1610,7 @@ improves performance.
 
 If you ever encounter a presumed highly unusual situation where you need to
 prevent ``vfork()`` from being used by Python, you can set the
-:attr:`subprocess._USE_VFORK` attribute to a false value.
+:const:`subprocess._USE_VFORK` attribute to a false value.
 
 ::
 
@@ -1618,7 +1618,7 @@ prevent ``vfork()`` from being used by Python, you can set the
 
 Setting this has no impact on use of ``posix_spawn()`` which could use
 ``vfork()`` internally within its libc implementation.  There is a similar
-:attr:`subprocess._USE_POSIX_SPAWN` attribute if you need to prevent use of
+:const:`subprocess._USE_POSIX_SPAWN` attribute if you need to prevent use of
 that.
 
 ::
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index bacf8ceac5041..12ba93d9e1847 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -166,7 +166,7 @@ always available.
    Python interpreter.  (This information is not available in any other way ---
    ``modules.keys()`` only lists the imported modules.)
 
-   See also the :attr:`sys.stdlib_module_names` list.
+   See also the :data:`sys.stdlib_module_names` list.
 
 
 .. function:: call_tracing(func, args)
@@ -1287,20 +1287,20 @@ always available.
    ================ ===========================
 
    .. versionchanged:: 3.3
-      On Linux, :attr:`sys.platform` doesn't contain the major version anymore.
+      On Linux, :data:`sys.platform` doesn't contain the major version anymore.
       It is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``.  Since
       older Python versions include the version number, it is recommended to
       always use the ``startswith`` idiom presented above.
 
    .. versionchanged:: 3.8
-      On AIX, :attr:`sys.platform` doesn't contain the major version anymore.
+      On AIX, :data:`sys.platform` doesn't contain the major version anymore.
       It is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``.  Since
       older Python versions include the version number, it is recommended to
       always use the ``startswith`` idiom presented above.
 
    .. seealso::
 
-      :attr:`os.name` has a coarser granularity.  :func:`os.uname` gives
+      :data:`os.name` has a coarser granularity.  :func:`os.uname` gives
       system-dependent version information.
 
       The :mod:`platform` module provides detailed checks for the
@@ -1743,7 +1743,7 @@ always available.
    ``email.mime`` sub-package and the ``email.message`` sub-module are not
    listed.
 
-   See also the :attr:`sys.builtin_module_names` list.
+   See also the :data:`sys.builtin_module_names` list.
 
    .. versionadded:: 3.10
 
diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst
index fd4820e78d68d..00f3070324ec1 100644
--- a/Doc/library/tarfile.rst
+++ b/Doc/library/tarfile.rst
@@ -938,7 +938,7 @@ reused in custom filters:
 
   Implements the ``'tar'`` filter.
 
-  - Strip leading slashes (``/`` and :attr:`os.sep`) from filenames.
+  - Strip leading slashes (``/`` and :data:`os.sep`) from filenames.
   - :ref:`Refuse <tarfile-extraction-refuse>` to extract files with absolute
     paths (in case the name is absolute
     even after stripping slashes, e.g. ``C:/foo`` on Windows).
@@ -947,7 +947,7 @@ reused in custom filters:
     path (after following symlinks) would end up outside the destination.
     This raises :class:`~tarfile.OutsideDestinationError`.
   - Clear high mode bits (setuid, setgid, sticky) and group/other write bits
-    (:attr:`~stat.S_IWGRP`|:attr:`~stat.S_IWOTH`).
+    (:const:`~stat.S_IWGRP`|:const:`~stat.S_IWOTH`).
 
   Return the modified ``TarInfo`` member.
 
@@ -972,10 +972,10 @@ reused in custom filters:
   - For regular files, including hard links:
 
     - Set the owner read and write permissions
-      (:attr:`~stat.S_IRUSR`|:attr:`~stat.S_IWUSR`).
+      (:const:`~stat.S_IRUSR`|:const:`~stat.S_IWUSR`).
     - Remove the group & other executable permission
-      (:attr:`~stat.S_IXGRP`|:attr:`~stat.S_IXOTH`)
-      if the owner doesn’t have it (:attr:`~stat.S_IXUSR`).
+      (:const:`~stat.S_IXGRP`|:const:`~stat.S_IXOTH`)
+      if the owner doesn’t have it (:const:`~stat.S_IXUSR`).
 
   - For other files (directories), set ``mode`` to ``None``, so
     that extraction methods skip applying permission bits.
diff --git a/Doc/library/test.rst b/Doc/library/test.rst
index 1b045c7de83a8..35cd6d5233c03 100644
--- a/Doc/library/test.rst
+++ b/Doc/library/test.rst
@@ -1040,7 +1040,7 @@ The :mod:`test.support` module defines the following classes:
    `SetErrorMode <https://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx>`_.
 
    On UNIX, :func:`resource.setrlimit` is used to set
-   :attr:`resource.RLIMIT_CORE`'s soft limit to 0 to prevent coredump file
+   :const:`resource.RLIMIT_CORE`'s soft limit to 0 to prevent coredump file
    creation.
 
    On both platforms, the old value is restored by :meth:`__exit__`.
diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst
index 988b0cf3d7066..9f6c3e3e862c4 100644
--- a/Doc/library/tkinter.rst
+++ b/Doc/library/tkinter.rst
@@ -163,7 +163,7 @@ the modern themed widget set and API::
    interpreter and calls :func:`exec` on the contents of
    :file:`.{className}.py` and :file:`.{baseName}.py`.  The path for the
    profile files is the :envvar:`HOME` environment variable or, if that
-   isn't defined, then :attr:`os.curdir`.
+   isn't defined, then :data:`os.curdir`.
 
    .. attribute:: tk
 
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index b26e6c0e6bc02..518bf6b13bad5 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -1134,7 +1134,7 @@ Test cases
 
       If given, *level* should be either a numeric logging level or
       its string equivalent (for example either ``"ERROR"`` or
-      :attr:`logging.ERROR`).  The default is :attr:`logging.INFO`.
+      :const:`logging.ERROR`).  The default is :const:`logging.INFO`.
 
       The test passes if at least one message emitted inside the ``with``
       block matches the *logger* and *level* conditions, otherwise it fails.
@@ -1175,7 +1175,7 @@ Test cases
 
       If given, *level* should be either a numeric logging level or
       its string equivalent (for example either ``"ERROR"`` or
-      :attr:`logging.ERROR`).  The default is :attr:`logging.INFO`.
+      :const:`logging.ERROR`).  The default is :const:`logging.INFO`.
 
       Unlike :meth:`assertLogs`, nothing will be returned by the context
       manager.
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 8a10a34347c2d..cbf854126bd5b 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2499,8 +2499,8 @@ through the object's keys; for sequences, it should iterate through the values.
 
    .. impl-detail::
 
-      In CPython, the length is required to be at most :attr:`sys.maxsize`.
-      If the length is larger than :attr:`!sys.maxsize` some features (such as
+      In CPython, the length is required to be at most :data:`sys.maxsize`.
+      If the length is larger than :data:`!sys.maxsize` some features (such as
       :func:`len`) may raise :exc:`OverflowError`.  To prevent raising
       :exc:`!OverflowError` by truth value testing, an object must define a
       :meth:`__bool__` method.
diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst
index ac1ba111e6d9b..d24450e2f963f 100644
--- a/Doc/using/windows.rst
+++ b/Doc/using/windows.rst
@@ -1201,7 +1201,7 @@ non-standard paths in the registry and user site-packages.
       Modules specified in the registry under ``Modules`` (not ``PythonPath``)
       may be imported by :class:`importlib.machinery.WindowsRegistryFinder`.
       This finder is enabled on Windows in 3.6.0 and earlier, but may need to
-      be explicitly added to :attr:`sys.meta_path` in the future.
+      be explicitly added to :data:`sys.meta_path` in the future.
 
 Additional modules
 ==================
diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst
index 85ffd170e7d11..ec4a7eb9a2361 100644
--- a/Doc/whatsnew/2.5.rst
+++ b/Doc/whatsnew/2.5.rst
@@ -1448,10 +1448,10 @@ complete list of changes, or look through the SVN logs for all the details.
   return times that are precise to fractions of a second; not all systems support
   such precision.)
 
-  Constants named :attr:`os.SEEK_SET`, :attr:`os.SEEK_CUR`, and
-  :attr:`os.SEEK_END` have been added; these are the parameters to the
+  Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, and
+  :const:`os.SEEK_END` have been added; these are the parameters to the
   :func:`os.lseek` function.  Two new constants for locking are
-  :attr:`os.O_SHLOCK` and :attr:`os.O_EXLOCK`.
+  :const:`os.O_SHLOCK` and :const:`os.O_EXLOCK`.
 
   Two new functions, :func:`wait3` and :func:`wait4`, were added.  They're similar
   the :func:`waitpid` function which waits for a child process to exit and returns
@@ -1602,7 +1602,7 @@ complete list of changes, or look through the SVN logs for all the details.
 
 * The :mod:`unicodedata` module has been updated to use version 4.1.0 of the
   Unicode character database.  Version 3.2.0 is required  by some specifications,
-  so it's still available as  :attr:`unicodedata.ucd_3_2_0`.
+  so it's still available as  :data:`unicodedata.ucd_3_2_0`.
 
 * New module: the  :mod:`uuid` module generates  universally unique identifiers
   (UUIDs) according to :rfc:`4122`.  The RFC defines several different UUID
diff --git a/Doc/whatsnew/3.1.rst b/Doc/whatsnew/3.1.rst
index 054762de7e743..c399f007fd63f 100644
--- a/Doc/whatsnew/3.1.rst
+++ b/Doc/whatsnew/3.1.rst
@@ -370,7 +370,7 @@ New, Improved, and Deprecated Modules
 * The :mod:`io` module has three new constants for the :meth:`seek`
   method :data:`SEEK_SET`, :data:`SEEK_CUR`, and :data:`SEEK_END`.
 
-* The :attr:`sys.version_info` tuple is now a named tuple::
+* The :data:`sys.version_info` tuple is now a named tuple::
 
     >>> sys.version_info
     sys.version_info(major=3, minor=1, micro=0, releaselevel='alpha', serial=2)
@@ -486,7 +486,7 @@ Changes to Python's build process and to the C API include:
 
   Apart from the performance improvements this change should be invisible to
   end users, with one exception: for testing and debugging purposes there's a
-  new :attr:`sys.int_info` that provides information about the
+  new :data:`sys.int_info` that provides information about the
   internal format, giving the number of bits per digit and the size in bytes
   of the C type used to store each digit::
 
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 92e85fc6c1480..859ee6e31649f 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -640,7 +640,7 @@ dataclasses
 datetime
 --------
 
-* Add :attr:`datetime.UTC`, a convenience alias for
+* Add :const:`datetime.UTC`, a convenience alias for
   :attr:`datetime.timezone.utc`. (Contributed by Kabir Kwatra in :gh:`91973`.)
 
 * :meth:`datetime.date.fromisoformat`, :meth:`datetime.time.fromisoformat` and
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index b3b9b4134a9bb..947ba1a35c12a 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -1042,7 +1042,7 @@ Deprecated
   datetimes in UTC: respectively, call
   :meth:`~datetime.datetime.now` and
   :meth:`~datetime.datetime.fromtimestamp`  with the *tz* parameter set to
-  :attr:`datetime.UTC`.
+  :const:`datetime.UTC`.
   (Contributed by Paul Ganssle in :gh:`103857`.)
 
 Pending Removal in Python 3.13
diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst
index c3f7ef6e56599..4275503a8633b 100644
--- a/Doc/whatsnew/3.2.rst
+++ b/Doc/whatsnew/3.2.rst
@@ -424,7 +424,7 @@ protocols, the users must to be able access the environment using native strings
 even though the underlying platform may have a different convention.  To bridge
 this gap, the :mod:`wsgiref` module has a new function,
 :func:`wsgiref.handlers.read_environ` for transcoding CGI variables from
-:attr:`os.environ` into native strings and returning a new dictionary.
+:data:`os.environ` into native strings and returning a new dictionary.
 
 .. seealso::
 
@@ -485,7 +485,7 @@ Some smaller changes made to the core Python language are:
 
 * The interpreter can now be started with a quiet option, ``-q``, to prevent
   the copyright and version information from being displayed in the interactive
-  mode.  The option can be introspected using the :attr:`sys.flags` attribute:
+  mode.  The option can be introspected using the :data:`sys.flags` attribute:
 
   .. code-block:: shell-session
 
@@ -568,7 +568,7 @@ Some smaller changes made to the core Python language are:
 
 * The internal :c:type:`structsequence` tool now creates subclasses of tuple.
   This means that C structures like those returned by :func:`os.stat`,
-  :func:`time.gmtime`, and :attr:`sys.version_info` now work like a
+  :func:`time.gmtime`, and :data:`sys.version_info` now work like a
   :term:`named tuple` and now work with functions and methods that
   expect a tuple as an argument.  This is a big step forward in making the C
   structures as flexible as their pure Python counterparts:
@@ -598,7 +598,7 @@ Some smaller changes made to the core Python language are:
   module, or on the command line.
 
   A :exc:`ResourceWarning` is issued at interpreter shutdown if the
-  :data:`gc.garbage` list isn't empty, and if :attr:`gc.DEBUG_UNCOLLECTABLE` is
+  :data:`gc.garbage` list isn't empty, and if :const:`gc.DEBUG_UNCOLLECTABLE` is
   set, all uncollectable objects are printed.  This is meant to make the
   programmer aware that their code contains object finalization issues.
 
@@ -623,7 +623,7 @@ Some smaller changes made to the core Python language are:
   :class:`collections.Sequence` :term:`abstract base class`.  As a result, the
   language will have a more uniform API.  In addition, :class:`range` objects
   now support slicing and negative indices, even with values larger than
-  :attr:`sys.maxsize`.  This makes *range* more interoperable with lists::
+  :data:`sys.maxsize`.  This makes *range* more interoperable with lists::
 
       >>> range(0, 100, 2).count(10)
       1
@@ -1007,13 +1007,13 @@ datetime and time
   after 1900.  The new supported year range is from 1000 to 9999 inclusive.
 
 * Whenever a two-digit year is used in a time tuple, the interpretation has been
-  governed by :attr:`time.accept2dyear`.  The default is ``True`` which means that
+  governed by :data:`time.accept2dyear`.  The default is ``True`` which means that
   for a two-digit year, the century is guessed according to the POSIX rules
   governing the ``%y`` strptime format.
 
   Starting with Py3.2, use of the century guessing heuristic will emit a
   :exc:`DeprecationWarning`.  Instead, it is recommended that
-  :attr:`time.accept2dyear` be set to ``False`` so that large date ranges
+  :data:`time.accept2dyear` be set to ``False`` so that large date ranges
   can be used without guesswork::
 
     >>> import time, warnings
@@ -1031,7 +1031,7 @@ datetime and time
     'Fri Jan  1 12:34:56 11'
 
   Several functions now have significantly expanded date ranges.  When
-  :attr:`time.accept2dyear` is false, the :func:`time.asctime` function will
+  :data:`time.accept2dyear` is false, the :func:`time.asctime` function will
   accept any year that fits in a C int, while the :func:`time.mktime` and
   :func:`time.strftime` functions will accept the full range supported by the
   corresponding operating system functions.
@@ -1194,11 +1194,11 @@ can be set to "$" for the shell-style formatting provided by
 
 If no configuration is set-up before a logging event occurs, there is now a
 default configuration using a :class:`~logging.StreamHandler` directed to
-:attr:`sys.stderr` for events of ``WARNING`` level or higher.  Formerly, an
+:data:`sys.stderr` for events of ``WARNING`` level or higher.  Formerly, an
 event occurring before a configuration was set-up would either raise an
 exception or silently drop the event depending on the value of
-:attr:`logging.raiseExceptions`.  The new default handler is stored in
-:attr:`logging.lastResort`.
+:data:`logging.raiseExceptions`.  The new default handler is stored in
+:data:`logging.lastResort`.
 
 The use of filters has been simplified.  Instead of creating a
 :class:`~logging.Filter` object, the predicate can be any Python callable that
@@ -1300,7 +1300,7 @@ values are equal (:issue:`8188`)::
           hash(Decimal("1.5")) == hash(complex(1.5, 0))
 
 Some of the hashing details are exposed through a new attribute,
-:attr:`sys.hash_info`, which describes the bit width of the hash value, the
+:data:`sys.hash_info`, which describes the bit width of the hash value, the
 prime modulus, the hash values for *infinity* and *nan*, and the multiplier
 used for the imaginary part of a number:
 
@@ -1388,7 +1388,7 @@ select
 ------
 
 The :mod:`select` module now exposes a new, constant attribute,
-:attr:`~select.PIPE_BUF`, which gives the minimum number of bytes which are
+:const:`~select.PIPE_BUF`, which gives the minimum number of bytes which are
 guaranteed not to block when :func:`select.select` says a pipe is ready
 for writing.
 
@@ -1529,7 +1529,7 @@ filenames:
 b'Sehensw\xc3\xbcrdigkeiten'
 
 Some operating systems allow direct access to encoded bytes in the
-environment.  If so, the :attr:`os.supports_bytes_environ` constant will be
+environment.  If so, the :const:`os.supports_bytes_environ` constant will be
 true.
 
 For direct access to encoded environment variables (if available),
@@ -2302,7 +2302,7 @@ turtledemo
 
 The demonstration code for the :mod:`turtle` module was moved from the *Demo*
 directory to main library.  It includes over a dozen sample scripts with
-lively displays.  Being on :attr:`sys.path`, it can now be run directly
+lively displays.  Being on :data:`sys.path`, it can now be run directly
 from the command-line:
 
 .. code-block:: shell-session
@@ -2566,7 +2566,7 @@ Changes to Python's build process and to the C API include:
   (:issue:`2443`).
 
 * A new C API function :c:func:`PySys_SetArgvEx` allows an embedded interpreter
-  to set :attr:`sys.argv` without also modifying :attr:`sys.path`
+  to set :data:`sys.argv` without also modifying :data:`sys.path`
   (:issue:`5753`).
 
 * :c:macro:`PyEval_CallObject` is now only available in macro form.  The
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
index 3dca7227a91c3..c108510b2aebd 100644
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -648,7 +648,7 @@ PEP 421: Adding sys.implementation
 
 A new attribute on the :mod:`sys` module exposes details specific to the
 implementation of the currently running interpreter.  The initial set of
-attributes on :attr:`sys.implementation` are ``name``, ``version``,
+attributes on :data:`sys.implementation` are ``name``, ``version``,
 ``hexversion``, and ``cache_tag``.
 
 The intention of ``sys.implementation`` is to consolidate into one namespace
@@ -719,7 +719,7 @@ and does not enforce any method requirements.
 
 In terms of finders, :class:`importlib.machinery.FileFinder` exposes the
 mechanism used to search for source and bytecode files of a module. Previously
-this class was an implicit member of :attr:`sys.path_hooks`.
+this class was an implicit member of :data:`sys.path_hooks`.
 
 For loaders, the new abstract base class :class:`importlib.abc.FileLoader` helps
 write a loader that uses the file system as the storage mechanism for a module's
@@ -735,7 +735,7 @@ provide the full name of the module now instead of just the tail end of the
 module's name.
 
 The :func:`importlib.invalidate_caches` function will now call the method with
-the same name on all finders cached in :attr:`sys.path_importer_cache` to help
+the same name on all finders cached in :data:`sys.path_importer_cache` to help
 clean up any stored state as necessary.
 
 Visible Changes
@@ -745,8 +745,8 @@ For potential required changes to code, see the `Porting Python code`_
 section.
 
 Beyond the expanse of what :mod:`importlib` now exposes, there are other
-visible changes to import. The biggest is that :attr:`sys.meta_path` and
-:attr:`sys.path_hooks` now store all of the meta path finders and path entry
+visible changes to import. The biggest is that :data:`sys.meta_path` and
+:data:`sys.path_hooks` now store all of the meta path finders and path entry
 hooks used by import.  Previously the finders were implicit and hidden within
 the C code of import instead of being directly exposed. This means that one can
 now easily remove or change the order of the various finders to fit one's needs.
@@ -761,9 +761,9 @@ Loaders are also now expected to set the ``__package__`` attribute from
 :pep:`366`. Once again, import itself is already setting this on all loaders
 from :mod:`importlib` and import itself is setting the attribute post-load.
 
-``None`` is now inserted into :attr:`sys.path_importer_cache` when no finder
-can be found on :attr:`sys.path_hooks`. Since :class:`!imp.NullImporter` is not
-directly exposed on :attr:`sys.path_hooks` it could no longer be relied upon to
+``None`` is now inserted into :data:`sys.path_importer_cache` when no finder
+can be found on :data:`sys.path_hooks`. Since :class:`!imp.NullImporter` is not
+directly exposed on :data:`sys.path_hooks` it could no longer be relied upon to
 always be available to use as a value representing no finder found.
 
 All other changes relate to semantic changes which should be taken into
@@ -1952,7 +1952,7 @@ ssl
 
 * You can query the SSL compression algorithm used by an SSL socket, thanks
   to its new :meth:`~ssl.SSLSocket.compression` method.  The new attribute
-  :attr:`~ssl.OP_NO_COMPRESSION` can be used to disable compression.
+  :const:`~ssl.OP_NO_COMPRESSION` can be used to disable compression.
   (Contributed by Antoine Pitrou in :issue:`13634`.)
 
 * Support has been added for the Next Protocol Negotiation extension using
@@ -1966,7 +1966,7 @@ ssl
 * The :func:`~ssl.get_server_certificate` function now supports IPv6.
   (Contributed by Charles-François Natali in :issue:`11811`.)
 
-* New attribute :attr:`~ssl.OP_CIPHER_SERVER_PREFERENCE` allows setting
+* New attribute :const:`~ssl.OP_CIPHER_SERVER_PREFERENCE` allows setting
   SSLv3 server sockets to use the server's cipher ordering preference rather
   than the client's (:issue:`13635`).
 
@@ -2141,7 +2141,7 @@ New attribute :attr:`zlib.Decompress.eof` makes it possible to distinguish
 between a properly formed compressed stream and an incomplete or truncated one.
 (Contributed by Nadeem Vawda in :issue:`12646`.)
 
-New attribute :attr:`zlib.ZLIB_RUNTIME_VERSION` reports the version string of
+New attribute :const:`zlib.ZLIB_RUNTIME_VERSION` reports the version string of
 the underlying ``zlib`` library that is loaded at runtime.  (Contributed by
 Torsten Landschoff in :issue:`12306`.)
 
@@ -2378,16 +2378,16 @@ Porting Python code
 * :func:`__import__` no longer allows one to use an index value other than 0
   for top-level modules. E.g. ``__import__('sys', level=1)`` is now an error.
 
-* Because :attr:`sys.meta_path` and :attr:`sys.path_hooks` now have finders on
+* Because :data:`sys.meta_path` and :data:`sys.path_hooks` now have finders on
   them by default, you will most likely want to use :meth:`list.insert` instead
   of :meth:`list.append` to add to those lists.
 
-* Because ``None`` is now inserted into :attr:`sys.path_importer_cache`, if you
+* Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if you
   are clearing out entries in the dictionary of paths that do not have a
   finder, you will need to remove keys paired with values of ``None`` **and**
   :class:`!imp.NullImporter` to be backwards-compatible. This will lead to extra
   overhead on older versions of Python that re-insert ``None`` into
-  :attr:`sys.path_importer_cache` where it represents the use of implicit
+  :data:`sys.path_importer_cache` where it represents the use of implicit
   finders, but semantically it should not change anything.
 
 * :class:`!importlib.abc.Finder` no longer specifies a ``find_module()`` abstract
@@ -2445,7 +2445,7 @@ Porting Python code
   error instead of sleeping forever.  It has always raised an error on posix.
 
 * The ``ast.__version__`` constant has been removed.  If you need to
-  make decisions affected by the AST version, use :attr:`sys.version_info`
+  make decisions affected by the AST version, use :data:`sys.version_info`
   to make the decision.
 
 * Code that used to work around the fact that the :mod:`threading` module used
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
index f3a8873747a3e..e753c3d364c2b 100644
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -1323,14 +1323,14 @@ ability to query or set the resource limits for processes other than the one
 making the call.  (Contributed by Christian Heimes in :issue:`16595`.)
 
 On Linux kernel version 2.6.36 or later, there are also some new
-Linux specific constants: :attr:`~resource.RLIMIT_MSGQUEUE`,
-:attr:`~resource.RLIMIT_NICE`, :attr:`~resource.RLIMIT_RTPRIO`,
-:attr:`~resource.RLIMIT_RTTIME`, and :attr:`~resource.RLIMIT_SIGPENDING`.
+Linux specific constants: :const:`~resource.RLIMIT_MSGQUEUE`,
+:const:`~resource.RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`,
+:const:`~resource.RLIMIT_RTTIME`, and :const:`~resource.RLIMIT_SIGPENDING`.
 (Contributed by Christian Heimes in :issue:`19324`.)
 
 On FreeBSD version 9 and later, there some new FreeBSD specific constants:
-:attr:`~resource.RLIMIT_SBSIZE`, :attr:`~resource.RLIMIT_SWAP`, and
-:attr:`~resource.RLIMIT_NPTS`.  (Contributed by Claudiu Popa in
+:const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, and
+:const:`~resource.RLIMIT_NPTS`.  (Contributed by Claudiu Popa in
 :issue:`19343`.)
 
 
@@ -1500,7 +1500,7 @@ implementation is required as most of the values aren't standardized and
 are platform-dependent.  (Contributed by Christian Heimes in :issue:`11016`.)
 
 The module supports new :mod:`~stat.ST_MODE` flags, :mod:`~stat.S_IFDOOR`,
-:attr:`~stat.S_IFPORT`, and :attr:`~stat.S_IFWHT`.  (Contributed by
+:const:`~stat.S_IFPORT`, and :const:`~stat.S_IFWHT`.  (Contributed by
 Christian Hiemes in :issue:`11016`.)
 
 
@@ -1849,7 +1849,7 @@ Python's default implementation to a SipHash implementation on platforms that
 have a 64 bit data type.  Any performance differences in comparison with the
 older FNV algorithm are trivial.
 
-The PEP adds additional fields to the :attr:`sys.hash_info` named tuple to
+The PEP adds additional fields to the :data:`sys.hash_info` named tuple to
 describe the hash algorithm in use by the currently executing binary.  Otherwise,
 the PEP does not alter any existing CPython APIs.
 
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 5161a0279452c..ed398f2e8c562 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -1388,7 +1388,7 @@ are treated as punctuation.
 site
 ----
 
-When specifying paths to add to :attr:`sys.path` in a ``.pth`` file,
+When specifying paths to add to :data:`sys.path` in a ``.pth`` file,
 you may now specify file paths on top of directories (e.g. zip files).
 (Contributed by Wolfgang Langner in :issue:`26587`).
 
@@ -2010,7 +2010,7 @@ been deprecated in previous versions of Python in favour of
 :meth:`importlib.abc.Loader.exec_module`.
 
 The :class:`importlib.machinery.WindowsRegistryFinder` class is now
-deprecated. As of 3.6.0, it is still added to :attr:`sys.meta_path` by
+deprecated. As of 3.6.0, it is still added to :data:`sys.meta_path` by
 default (on Windows), but this may change in future releases.
 
 os
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index b27fcce8178c4..3efb3f49b77ac 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -1839,7 +1839,7 @@ Changes in Python behavior
   classes will affect their string representation.
   (Contributed by Serhiy Storchaka in :issue:`36793`.)
 
-* On AIX, :attr:`sys.platform` doesn't contain the major version anymore.
+* On AIX, :data:`sys.platform` doesn't contain the major version anymore.
   It is always ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``.  Since
   older Python versions include the version number, so it is recommended to
   always use ``sys.platform.startswith('aix')``.
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index d1e7efa079921..a8f9774af7add 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -692,13 +692,13 @@ which has nanosecond resolution, rather than
 sys
 ---
 
-Added a new :attr:`sys.platlibdir` attribute: name of the platform-specific
+Added a new :data:`sys.platlibdir` attribute: name of the platform-specific
 library directory. It is used to build the path of standard library and the
 paths of installed extension modules. It is equal to ``"lib"`` on most
 platforms.  On Fedora and SuSE, it is equal to ``"lib64"`` on 64-bit platforms.
 (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis and Victor Stinner in :issue:`1294959`.)
 
-Previously, :attr:`sys.stderr` was block-buffered when non-interactive. Now
+Previously, :data:`sys.stderr` was block-buffered when non-interactive. Now
 ``stderr`` defaults to always being line-buffered.
 (Contributed by Jendrik Seipp in :issue:`13601`.)
 
@@ -1226,8 +1226,8 @@ Build Changes
 =============
 
 * Added ``--with-platlibdir`` option to the ``configure`` script: name of the
-  platform-specific library directory, stored in the new :attr:`sys.platlibdir`
-  attribute. See :attr:`sys.platlibdir` attribute for more information.
+  platform-specific library directory, stored in the new :data:`sys.platlibdir`
+  attribute. See :data:`sys.platlibdir` attribute for more information.
   (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis
   and Victor Stinner in :issue:`1294959`.)
 
diff --git a/Misc/NEWS.d/3.12.0a1.rst b/Misc/NEWS.d/3.12.0a1.rst
index 0609270c6805b..c4dfc6011ed6c 100644
--- a/Misc/NEWS.d/3.12.0a1.rst
+++ b/Misc/NEWS.d/3.12.0a1.rst
@@ -4171,7 +4171,7 @@ Add an index_pages parameter to support using non-default index page names.
 .. nonce: qtT3CE
 .. section: Library
 
-Drop support for :class:`bytes` on :attr:`sys.path`.
+Drop support for :class:`bytes` on :data:`sys.path`.
 
 ..
 
diff --git a/Misc/NEWS.d/3.8.0a4.rst b/Misc/NEWS.d/3.8.0a4.rst
index 9841195210c9e..a0d60f456789f 100644
--- a/Misc/NEWS.d/3.8.0a4.rst
+++ b/Misc/NEWS.d/3.8.0a4.rst
@@ -92,7 +92,7 @@ the field.
 .. nonce: wejLoC
 .. section: Core and Builtins
 
-On AIX, :attr:`sys.platform` doesn't contain the major version anymore.
+On AIX, :data:`sys.platform` doesn't contain the major version anymore.
 Always return ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``.  Since older
 Python versions include the version number, it is recommended to always use
 ``sys.platform.startswith('aix')``. Contributed by M. Felt.
diff --git a/Misc/NEWS.d/3.9.0a5.rst b/Misc/NEWS.d/3.9.0a5.rst
index 25342d21d8f0b..8a1219501e81b 100644
--- a/Misc/NEWS.d/3.9.0a5.rst
+++ b/Misc/NEWS.d/3.9.0a5.rst
@@ -582,7 +582,7 @@ Fix :mod:`json.tool` to catch :exc:`BrokenPipeError`. Patch by Dong-hee Na.
 
 Avoid a possible *"RuntimeError: dictionary changed size during iteration"*
 from :func:`inspect.getmodule` when it tried to loop through
-:attr:`sys.modules`.
+:data:`sys.modules`.
 
 ..
 
@@ -989,7 +989,7 @@ modules are built.
 
 Add ``--with-platlibdir`` option to the configure script: name of the
 platform-specific library directory, stored in the new
-:attr:`sys.platlibdir` attribute. It is used to build the path of
+:data:`sys.platlibdir` attribute. It is used to build the path of
 platform-specific extension modules and the path of the standard library. It
 is equal to ``"lib"`` on most platforms. On Fedora and SuSE, it is equal to
 ``"lib64"`` on 64-bit platforms. Patch by Jan Matějek, Matěj Cepl,



More information about the Python-checkins mailing list