Skip to content

Commit 0f42f41

Browse files
[3.12] gh-107091: Fix some uses of :const: role (GH-107379) (GH-107384)
It is for references, not for literals. (cherry picked from commit 0aa58fa) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 3f167de commit 0f42f41

File tree

10 files changed

+29
-30
lines changed

10 files changed

+29
-30
lines changed

Doc/library/fcntl.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ The module defines the following functions:
172172
which the lock starts, relative to *whence*, and *whence* is as with
173173
:func:`io.IOBase.seek`, specifically:
174174

175-
* :const:`0` -- relative to the start of the file (:const:`os.SEEK_SET`)
176-
* :const:`1` -- relative to the current buffer position (:const:`os.SEEK_CUR`)
177-
* :const:`2` -- relative to the end of the file (:const:`os.SEEK_END`)
175+
* ``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)
176+
* ``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)
177+
* ``2`` -- relative to the end of the file (:const:`os.SEEK_END`)
178178

179179
The default for *start* is 0, which means to start at the beginning of the file.
180180
The default for *len* is 0 which means to lock to the end of the file. The

Doc/library/fractions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ another rational number, or from a string.
2525

2626
The first version requires that *numerator* and *denominator* are instances
2727
of :class:`numbers.Rational` and returns a new :class:`Fraction` instance
28-
with value ``numerator/denominator``. If *denominator* is :const:`0`, it
28+
with value ``numerator/denominator``. If *denominator* is ``0``, it
2929
raises a :exc:`ZeroDivisionError`. The second version requires that
3030
*other_fraction* is an instance of :class:`numbers.Rational` and returns a
3131
:class:`Fraction` instance with the same value. The next two versions accept

Doc/library/logging.handlers.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ sends logging output to a disk file. It inherits the output functionality from
9797

9898
Returns a new instance of the :class:`FileHandler` class. The specified file is
9999
opened and used as the stream for logging. If *mode* is not specified,
100-
:const:`'a'` is used. If *encoding* is not ``None``, it is used to open the file
100+
``'a'`` is used. If *encoding* is not ``None``, it is used to open the file
101101
with that encoding. If *delay* is true, then file opening is deferred until the
102102
first call to :meth:`emit`. By default, the file grows indefinitely. If
103103
*errors* is specified, it's used to determine how encoding errors are handled.
@@ -182,7 +182,7 @@ for this value.
182182

183183
Returns a new instance of the :class:`WatchedFileHandler` class. The specified
184184
file is opened and used as the stream for logging. If *mode* is not specified,
185-
:const:`'a'` is used. If *encoding* is not ``None``, it is used to open the file
185+
``'a'`` is used. If *encoding* is not ``None``, it is used to open the file
186186
with that encoding. If *delay* is true, then file opening is deferred until the
187187
first call to :meth:`emit`. By default, the file grows indefinitely. If
188188
*errors* is provided, it determines how encoding errors are handled.

Doc/library/os.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,11 @@ process and user.
401401

402402
On macOS, :func:`getgroups` behavior differs somewhat from
403403
other Unix platforms. If the Python interpreter was built with a
404-
deployment target of :const:`10.5` or earlier, :func:`getgroups` returns
404+
deployment target of ``10.5`` or earlier, :func:`getgroups` returns
405405
the list of effective group ids associated with the current user process;
406406
this list is limited to a system-defined number of entries, typically 16,
407407
and may be modified by calls to :func:`setgroups` if suitably privileged.
408-
If built with a deployment target greater than :const:`10.5`,
408+
If built with a deployment target greater than ``10.5``,
409409
:func:`getgroups` returns the current group access list for the user
410410
associated with the effective user id of the process; the group access
411411
list may change over the lifetime of the process, it is not affected by

Doc/library/signal.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ The :mod:`signal` module defines the following functions:
656656
.. function:: sigtimedwait(sigset, timeout)
657657

658658
Like :func:`sigwaitinfo`, but takes an additional *timeout* argument
659-
specifying a timeout. If *timeout* is specified as :const:`0`, a poll is
659+
specifying a timeout. If *timeout* is specified as ``0``, a poll is
660660
performed. Returns :const:`None` if a timeout occurs.
661661

662662
.. availability:: Unix.

Doc/library/ssl.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ Random generation
320320

321321
Mix the given *bytes* into the SSL pseudo-random number generator. The
322322
parameter *entropy* (a float) is a lower bound on the entropy contained in
323-
string (so you can always use :const:`0.0`). See :rfc:`1750` for more
323+
string (so you can always use ``0.0``). See :rfc:`1750` for more
324324
information on sources of entropy.
325325

326326
.. versionchanged:: 3.5

Doc/library/subprocess.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,9 @@ functions.
465465
:func:`open` function when creating the stdin/stdout/stderr pipe
466466
file objects:
467467

468-
- :const:`0` means unbuffered (read and write are one
468+
- ``0`` means unbuffered (read and write are one
469469
system call and can return short)
470-
- :const:`1` means line buffered
470+
- ``1`` means line buffered
471471
(only usable if ``text=True`` or ``universal_newlines=True``)
472472
- any other positive value means use a buffer of approximately that
473473
size
@@ -477,7 +477,7 @@ functions.
477477
.. versionchanged:: 3.3.1
478478
*bufsize* now defaults to -1 to enable buffering by default to match the
479479
behavior that most code expects. In versions prior to Python 3.2.4 and
480-
3.3.1 it incorrectly defaulted to :const:`0` which was unbuffered
480+
3.3.1 it incorrectly defaulted to ``0`` which was unbuffered
481481
and allowed short reads. This was unintentional and did not match the
482482
behavior of Python 2 as most code expected.
483483

@@ -541,8 +541,8 @@ functions.
541541
:exc:`RuntimeError`. The new restriction may affect applications that
542542
are deployed in mod_wsgi, uWSGI, and other embedded environments.
543543

544-
If *close_fds* is true, all file descriptors except :const:`0`, :const:`1` and
545-
:const:`2` will be closed before the child process is executed. Otherwise
544+
If *close_fds* is true, all file descriptors except ``0``, ``1`` and
545+
``2`` will be closed before the child process is executed. Otherwise
546546
when *close_fds* is false, file descriptors obey their inheritable flag
547547
as described in :ref:`fd_inheritance`.
548548

Doc/library/sys.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -877,19 +877,19 @@ always available.
877877
``sys.getwindowsversion().major``. For compatibility with prior
878878
versions, only the first 5 elements are retrievable by indexing.
879879

880-
*platform* will be :const:`2 (VER_PLATFORM_WIN32_NT)`.
880+
*platform* will be ``2`` (VER_PLATFORM_WIN32_NT).
881881

882882
*product_type* may be one of the following values:
883883

884884
+---------------------------------------+---------------------------------+
885885
| Constant | Meaning |
886886
+=======================================+=================================+
887-
| :const:`1 (VER_NT_WORKSTATION)` | The system is a workstation. |
887+
| ``1`` (VER_NT_WORKSTATION) | The system is a workstation. |
888888
+---------------------------------------+---------------------------------+
889-
| :const:`2 (VER_NT_DOMAIN_CONTROLLER)` | The system is a domain |
889+
| ``2`` (VER_NT_DOMAIN_CONTROLLER) | The system is a domain |
890890
| | controller. |
891891
+---------------------------------------+---------------------------------+
892-
| :const:`3 (VER_NT_SERVER)` | The system is a server, but not |
892+
| ``3`` (VER_NT_SERVER) | The system is a server, but not |
893893
| | a domain controller. |
894894
+---------------------------------------+---------------------------------+
895895

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ Doc/library/faulthandler.rst
100100
Doc/library/fcntl.rst
101101
Doc/library/filecmp.rst
102102
Doc/library/fileinput.rst
103-
Doc/library/fractions.rst
104103
Doc/library/ftplib.rst
105104
Doc/library/functions.rst
106105
Doc/library/functools.rst

Doc/whatsnew/3.3.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -1135,20 +1135,20 @@ API changes
11351135
* The C module has the following context limits, depending on the machine
11361136
architecture:
11371137

1138-
+-------------------+---------------------+------------------------------+
1139-
| | 32-bit | 64-bit |
1140-
+===================+=====================+==============================+
1141-
| :const:`MAX_PREC` | :const:`425000000` | :const:`999999999999999999` |
1142-
+-------------------+---------------------+------------------------------+
1143-
| :const:`MAX_EMAX` | :const:`425000000` | :const:`999999999999999999` |
1144-
+-------------------+---------------------+------------------------------+
1145-
| :const:`MIN_EMIN` | :const:`-425000000` | :const:`-999999999999999999` |
1146-
+-------------------+---------------------+------------------------------+
1138+
+-------------------+----------------+-------------------------+
1139+
| | 32-bit | 64-bit |
1140+
+===================+================+=========================+
1141+
| :const:`MAX_PREC` | ``425000000`` | ``999999999999999999`` |
1142+
+-------------------+----------------+-------------------------+
1143+
| :const:`MAX_EMAX` | ``425000000`` | ``999999999999999999`` |
1144+
+-------------------+----------------+-------------------------+
1145+
| :const:`MIN_EMIN` | ``-425000000`` | ``-999999999999999999`` |
1146+
+-------------------+----------------+-------------------------+
11471147

11481148
* In the context templates (:class:`~decimal.DefaultContext`,
11491149
:class:`~decimal.BasicContext` and :class:`~decimal.ExtendedContext`)
11501150
the magnitude of :attr:`~decimal.Context.Emax` and
1151-
:attr:`~decimal.Context.Emin` has changed to :const:`999999`.
1151+
:attr:`~decimal.Context.Emin` has changed to ``999999``.
11521152

11531153
* The :class:`~decimal.Decimal` constructor in decimal.py does not observe
11541154
the context limits and converts values with arbitrary exponents or precision

0 commit comments

Comments
 (0)