Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c343252

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

File tree

10 files changed

+29
-30
lines changed

10 files changed

+29
-30
lines changed

Doc/library/fcntl.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ The module defines the following functions:
166166
which the lock starts, relative to *whence*, and *whence* is as with
167167
:func:`io.IOBase.seek`, specifically:
168168

169-
* :const:`0` -- relative to the start of the file (:const:`os.SEEK_SET`)
170-
* :const:`1` -- relative to the current buffer position (:const:`os.SEEK_CUR`)
171-
* :const:`2` -- relative to the end of the file (:const:`os.SEEK_END`)
169+
* ``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)
170+
* ``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)
171+
* ``2`` -- relative to the end of the file (:const:`os.SEEK_END`)
172172

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

Doc/library/fractions.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ Random generation
344344

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

350350
.. versionchanged:: 3.5

Doc/library/subprocess.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,9 @@ functions.
463463
:func:`open` function when creating the stdin/stdout/stderr pipe
464464
file objects:
465465

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

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

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

Doc/library/sys.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -850,19 +850,19 @@ always available.
850850
``sys.getwindowsversion().major``. For compatibility with prior
851851
versions, only the first 5 elements are retrievable by indexing.
852852

853-
*platform* will be :const:`2 (VER_PLATFORM_WIN32_NT)`.
853+
*platform* will be ``2`` (VER_PLATFORM_WIN32_NT).
854854

855855
*product_type* may be one of the following values:
856856

857857
+---------------------------------------+---------------------------------+
858858
| Constant | Meaning |
859859
+=======================================+=================================+
860-
| :const:`1 (VER_NT_WORKSTATION)` | The system is a workstation. |
860+
| ``1`` (VER_NT_WORKSTATION) | The system is a workstation. |
861861
+---------------------------------------+---------------------------------+
862-
| :const:`2 (VER_NT_DOMAIN_CONTROLLER)` | The system is a domain |
862+
| ``2`` (VER_NT_DOMAIN_CONTROLLER) | The system is a domain |
863863
| | controller. |
864864
+---------------------------------------+---------------------------------+
865-
| :const:`3 (VER_NT_SERVER)` | The system is a server, but not |
865+
| ``3`` (VER_NT_SERVER) | The system is a server, but not |
866866
| | a domain controller. |
867867
+---------------------------------------+---------------------------------+
868868

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ Doc/library/faulthandler.rst
9090
Doc/library/fcntl.rst
9191
Doc/library/filecmp.rst
9292
Doc/library/fileinput.rst
93-
Doc/library/fractions.rst
9493
Doc/library/ftplib.rst
9594
Doc/library/functions.rst
9695
Doc/library/functools.rst

Doc/whatsnew/3.3.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,20 +1134,20 @@ API changes
11341134
* The C module has the following context limits, depending on the machine
11351135
architecture:
11361136

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

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

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

0 commit comments

Comments
 (0)