Skip to content

Commit 078ab82

Browse files
Use roles :data: and :const: for referencing module variables (GH-129507)
1 parent 96ff4c2 commit 078ab82

19 files changed

+39
-39
lines changed

Doc/howto/free-threading-python.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Identifying free-threaded Python
4343
================================
4444

4545
To check if the current interpreter supports free-threading, :option:`python -VV <-V>`
46-
and :attr:`sys.version` contain "experimental free-threading build".
46+
and :data:`sys.version` contain "experimental free-threading build".
4747
The new :func:`sys._is_gil_enabled` function can be used to check whether
4848
the GIL is actually disabled in the running process.
4949

Doc/library/datetime.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The :mod:`!datetime` module exports the following constants:
9393
The largest year number allowed in a :class:`date` or :class:`.datetime` object.
9494
:const:`MAXYEAR` is 9999.
9595

96-
.. attribute:: UTC
96+
.. data:: UTC
9797

9898
Alias for the UTC time zone singleton :attr:`datetime.timezone.utc`.
9999

@@ -970,7 +970,7 @@ Other constructors, all class methods:
970970

971971
.. deprecated:: 3.12
972972

973-
Use :meth:`datetime.now` with :attr:`UTC` instead.
973+
Use :meth:`datetime.now` with :const:`UTC` instead.
974974

975975

976976
.. classmethod:: datetime.fromtimestamp(timestamp, tz=None)
@@ -1042,7 +1042,7 @@ Other constructors, all class methods:
10421042

10431043
.. deprecated:: 3.12
10441044

1045-
Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead.
1045+
Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead.
10461046

10471047

10481048
.. classmethod:: datetime.fromordinal(ordinal)

Doc/library/decimal.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2262,7 +2262,7 @@ value for :attr:`~Context.prec` as well [#]_::
22622262
Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')
22632263

22642264

2265-
For inexact results, :attr:`MAX_PREC` is far too large on 64-bit platforms and
2265+
For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms and
22662266
the available memory will be insufficient::
22672267

22682268
>>> Decimal(1) / 3

Doc/library/filecmp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ The :class:`dircmp` class
189189
are the same type as *self*, if *self* is a subclass of
190190
:class:`dircmp`.
191191

192-
.. attribute:: DEFAULT_IGNORES
192+
.. data:: DEFAULT_IGNORES
193193

194194
.. versionadded:: 3.4
195195

Doc/library/importlib.metadata.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Mapping import to distribution packages
375375
.. function:: packages_distributions()
376376

377377
Return a mapping from the top level module and import package
378-
names found via :attr:`sys.meta_path` to the names of the distribution
378+
names found via :data:`sys.meta_path` to the names of the distribution
379379
packages (if any) that provide the corresponding files.
380380

381381
To allow for namespace packages (which may have members provided by

Doc/library/importlib.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ ABC hierarchy::
746746
suitable for reading (same as :attr:`pathlib.Path.open`).
747747

748748
When opening as text, accepts encoding parameters such as those
749-
accepted by :attr:`io.TextIOWrapper`.
749+
accepted by :class:`io.TextIOWrapper`.
750750

751751
.. method:: read_bytes()
752752

@@ -794,34 +794,34 @@ ABC hierarchy::
794794
This module contains the various objects that help :keyword:`import`
795795
find and load modules.
796796

797-
.. attribute:: SOURCE_SUFFIXES
797+
.. data:: SOURCE_SUFFIXES
798798

799799
A list of strings representing the recognized file suffixes for source
800800
modules.
801801

802802
.. versionadded:: 3.3
803803

804-
.. attribute:: DEBUG_BYTECODE_SUFFIXES
804+
.. data:: DEBUG_BYTECODE_SUFFIXES
805805

806806
A list of strings representing the file suffixes for non-optimized bytecode
807807
modules.
808808

809809
.. versionadded:: 3.3
810810

811811
.. deprecated:: 3.5
812-
Use :attr:`BYTECODE_SUFFIXES` instead.
812+
Use :const:`BYTECODE_SUFFIXES` instead.
813813

814-
.. attribute:: OPTIMIZED_BYTECODE_SUFFIXES
814+
.. data:: OPTIMIZED_BYTECODE_SUFFIXES
815815

816816
A list of strings representing the file suffixes for optimized bytecode
817817
modules.
818818

819819
.. versionadded:: 3.3
820820

821821
.. deprecated:: 3.5
822-
Use :attr:`BYTECODE_SUFFIXES` instead.
822+
Use :const:`BYTECODE_SUFFIXES` instead.
823823

824-
.. attribute:: BYTECODE_SUFFIXES
824+
.. data:: BYTECODE_SUFFIXES
825825

826826
A list of strings representing the recognized file suffixes for bytecode
827827
modules (including the leading dot).
@@ -831,7 +831,7 @@ find and load modules.
831831
.. versionchanged:: 3.5
832832
The value is no longer dependent on ``__debug__``.
833833

834-
.. attribute:: EXTENSION_SUFFIXES
834+
.. data:: EXTENSION_SUFFIXES
835835

836836
A list of strings representing the recognized file suffixes for
837837
extension modules.
@@ -1109,7 +1109,7 @@ find and load modules.
11091109
.. method:: is_package(fullname)
11101110

11111111
Returns ``True`` if the file path points to a package's ``__init__``
1112-
module based on :attr:`EXTENSION_SUFFIXES`.
1112+
module based on :const:`EXTENSION_SUFFIXES`.
11131113

11141114
.. method:: get_code(fullname)
11151115

@@ -1294,7 +1294,7 @@ find and load modules.
12941294
This module contains the various objects that help in the construction of
12951295
an :term:`importer`.
12961296

1297-
.. attribute:: MAGIC_NUMBER
1297+
.. data:: MAGIC_NUMBER
12981298

12991299
The bytes which represent the bytecode version number. If you need help with
13001300
loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`.

Doc/library/logging.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ in a module, ``__name__`` is the module's name in the Python package namespace.
342342

343343
If no handler is attached to this logger (or any of its ancestors,
344344
taking into account the relevant :attr:`Logger.propagate` attributes),
345-
the message will be sent to the handler set on :attr:`lastResort`.
345+
the message will be sent to the handler set on :data:`lastResort`.
346346

347347
.. versionchanged:: 3.2
348348
The *stack_info* parameter was added.
@@ -1495,7 +1495,7 @@ functions.
14951495
Module-Level Attributes
14961496
-----------------------
14971497

1498-
.. attribute:: lastResort
1498+
.. data:: lastResort
14991499

15001500
A "handler of last resort" is available through this attribute. This
15011501
is a :class:`StreamHandler` writing to ``sys.stderr`` with a level of
@@ -1507,7 +1507,7 @@ Module-Level Attributes
15071507

15081508
.. versionadded:: 3.2
15091509

1510-
.. attribute:: raiseExceptions
1510+
.. data:: raiseExceptions
15111511

15121512
Used to see if exceptions during handling should be propagated.
15131513

Doc/library/plistlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ This module defines the following functions:
7171

7272
When *aware_datetime* is true, fields with type ``datetime.datetime`` will
7373
be created as :ref:`aware object <datetime-naive-aware>`, with
74-
:attr:`!tzinfo` as :attr:`datetime.UTC`.
74+
:attr:`!tzinfo` as :const:`datetime.UTC`.
7575

7676
XML data for the :data:`FMT_XML` format is parsed using the Expat parser
7777
from :mod:`xml.parsers.expat` -- see its documentation for possible

Doc/library/select.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ The module defines the following:
165165
:exc:`InterruptedError`.
166166

167167

168-
.. attribute:: PIPE_BUF
168+
.. data:: PIPE_BUF
169169

170170
The minimum number of bytes which can be written without blocking to a pipe
171171
when the pipe has been reported as ready for writing by :func:`~select.select`,

Doc/library/site.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ are skipped. For the tail part, it uses the empty string and then
3535
:file:`lib/site-packages` (on Windows) or
3636
:file:`lib/python{X.Y[t]}/site-packages` (on Unix and macOS). (The
3737
optional suffix "t" indicates the :term:`free threading` build, and is
38-
appended if ``"t"`` is present in the :attr:`sys.abiflags` constant.)
38+
appended if ``"t"`` is present in the :data:`sys.abiflags` constant.)
3939
For each
4040
of the distinct head-tail combinations, it sees if it refers to an existing
4141
directory, and if so, adds it to ``sys.path`` and also inspects the newly

0 commit comments

Comments
 (0)