10000 gh-106892: Use roles :data: and :const: for referencing module variab… · serhiy-storchaka/cpython@d036db7 · GitHub
[go: up one dir, main page]

Skip to content

Commit d036db7

Browse files
pythongh-106892: Use roles :data: and :const: for referencing module variables (pythonGH-106894)
1 parent 8d397ee commit d036db7

40 files changed

+111
-111
lines changed

Doc/c-api/import.rst

-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ Importing Modules
142142
read from a Python bytecode file or obtained from the built-in function
143143
:func:`compile`, load the module. Return a new reference to the module object,
144144
or ``NULL`` with an exception set if an error occurred. *name*
145-
is removed from :attr:`sys.modules` in error cases, even if *name* was already
146-
in :attr:`sys.modules` on entry to :c:func:`PyImport_ExecCodeModule`. Leaving
147-
incompletely initialized modules in :attr:`sys.modules` is dangerous, as imports of
145+
is removed from :data:`sys.modules` in error cases, even if *name* was already
146+
in :data:`sys.modules` on entry to :c:func:`PyImport_ExecCodeModule`. Leaving
147+
incompletely initialized modules in :data:`sys.modules` is dangerous, as imports of
148148
such modules have no way to know that the module object is an unknown (and
149149
probably damaged with respect to the module author's intents) state.
150150

Doc/library/__main__.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,12 @@ Note that importing ``__main__`` doesn't cause any issues with unintentionally
336336
running top-level code meant for script use which is put in the
337337
``if __name__ == "__main__"`` block of the ``start`` module. Why does this work?
338338

339-
Python inserts an empty ``__main__`` module in :attr:`sys.modules` at
339+
Python inserts an empty ``__main__`` module in :data:`sys.modules` at
340340
interpreter startup, and populates it by running top-level code. In our example
341341
this is the ``start`` module which runs line by line and imports ``namely``.
342342
In turn, ``namely`` imports ``__main__`` (which is really ``start``). That's an
343343
import cycle! Fortunately, since the partially populated ``__main__``
344-
module is present in :attr:`sys.modules`, Python passes that to ``namely``.
344+
module is present in :data:`sys.modules`, Python passes that to ``namely``.
345345
See :ref:`Special considerations for __main__ <import-dunder-main>` in the
346346
import system's reference for details on how this works.
347347

Doc/library/asyncio-subprocess.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Creating Subprocesses
6868

6969
The *limit* argument sets the buffer limit for :class:`StreamReader`
7070
wrappers for :attr:`Process.stdout` and :attr:`Process.stderr`
71-
(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
71+
(if :const:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
7272

7373
Return a :class:`~asyncio.subprocess.Process` instance.
7474

@@ -86,7 +86,7 @@ Creating Subprocesses
8686

8787
The *limit* argument sets the buffer limit for :class:`StreamReader`
8888
wrappers for :attr:`Process.stdout` and :attr:`Process.stderr`
89-
(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
89+
(if :const:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
9090

9191
Return a :class:`~asyncio.subprocess.Process` instance.
9292

Doc/library/compileall.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ There is no command-line option to control the optimization level used by the
141141
:func:`compile` function, because the Python interpreter itself already
142142
provides the option: :program:`python -O -m compileall`.
143143

144-
Similarly, the :func:`compile` function respects the :attr:`sys.pycache_prefix`
144+
Similarly, the :func:`compile` function respects the :data:`sys.pycache_prefix`
145145
setting. The generated bytecode cache will only be useful if :func:`compile` is
146-
run with the same :attr:`sys.pycache_prefix` (if any) that will be used at
146+
run with the same :data:`sys.pycache_prefix` (if any) that will be used at
147147
runtime.
148148

149149
Public functions

Doc/library/devmode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Effects of the Python Development Mode:
8181
ignored for empty strings.
8282

8383
* The :class:`io.IOBase` destructor logs ``close()`` exceptions.
84-
* Set the :attr:`~sys.flags.dev_mode` attribute of :attr:`sys.flags` to
84+
* Set the :attr:`~sys.flags.dev_mode` attribute of :data:`sys.flags` to
8585
``True``.
8686

8787
The Python Development Mode does not enable the :mod:`tracemalloc` module by

Doc/library/filecmp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The :class:`dircmp` class
7474

7575
Construct a new directory comparison object, to compare the directories *a*
7676
and *b*. *ignore* is a list of names to ignore, and defaults to
77-
:attr:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and
77+
:const:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and
7878
defaults to ``[os.curdir, os.pardir]``.
7979

8080
The :class:`dircmp` class compares files by doing *shallow* comparisons

Doc/library/ftplib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ FTP_TLS Objects
431431

432432
.. attribute:: FTP_TLS.ssl_version
433433

434-
The SSL version to use (defaults to :attr:`ssl.PROTOCOL_SSLv23`).
434+
The SSL version to use (defaults to :data:`ssl.PROTOCOL_SSLv23`).
435435

436436
.. method:: FTP_TLS.auth()
437437

Doc/library/functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ are always available. They are listed here in alphabetical order.
12311231

12321232
* Binary files are buffered in fixed-size chunks; the size of the buffer is
12331233
chosen using a heuristic trying to determine the underlying device's "block
1234-
size" and falling back on :attr:`io.DEFAULT_BUFFER_SIZE`. On many systems,
1234+
size" and falling back on :const:`io.DEFAULT_BUFFER_SIZE`. On many systems,
12351235
the buffer will typically be 4096 or 8192 bytes long.
12361236

12371237
* "Interactive" text files (files for which :meth:`~io.IOBase.isatty`

Doc/library/gc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ values but should not rebind them):
260260

261261
.. versionchanged:: 3.4
262262
Following :pep:`442`, objects with a :meth:`~object.__del__` method don't end
263-
up in :attr:`gc.garbage` anymore.
263+
up in :data:`gc.garbage` anymore.
264264

265265
.. data:: callbacks
266266

Doc/library/gzip.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ Command line options
268268

269269
.. cmdoption:: file
270270

271-
If *file* is not specified, read from :attr:`sys.stdin`.
271+
If *file* is not specified, read from :data:`sys.stdin`.
272272

273273
.. cmdoption:: --fast
274274

0 commit comments

Comments
 (0)
0