Skip to content

Commit 1ba968b

Browse files
gh-109634: Use :samp: role
1 parent 9ccf054 commit 1ba968b

22 files changed

+80
-78
lines changed

Doc/extending/windows.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,4 @@ modules (including Python) to be able to see your identifiers, you have to say
132132
Developer Studio will throw in a lot of import libraries that you do not really
133133
need, adding about 100K to your executable. To get rid of them, use the Project
134134
Settings dialog, Link tab, to specify *ignore default libraries*. Add the
135-
correct :file:`msvcrtxx.lib` to the list of libraries.
135+
correct :file:`msvcrt{xx}.lib` to the list of libraries.

Doc/howto/logging-cookbook.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ when (and if) the logged message is actually about to be output to a log by a
17281728
handler. So the only slightly unusual thing which might trip you up is that the
17291729
parentheses go around the format string and the arguments, not just the format
17301730
string. That's because the __ notation is just syntax sugar for a constructor
1731-
call to one of the XXXMessage classes.
1731+
call to one of the :samp:`{XXX}Message` classes.
17321732

17331733
If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar effect
17341734
to the above, as in the following example::
@@ -2644,7 +2644,7 @@ when (and if) the logged message is actually about to be output to a log by a
26442644
handler. So the only slightly unusual thing which might trip you up is that the
26452645
parentheses go around the format string and the arguments, not just the format
26462646
string. That’s because the __ notation is just syntax sugar for a constructor
2647-
call to one of the ``XXXMessage`` classes shown above.
2647+
call to one of the :samp:`{XXX}Message` classes shown above.
26482648

26492649

26502650
.. _filters-dictconfig:

Doc/howto/logging.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ provided:
979979

980980
#. :class:`NullHandler` instances do nothing with error messages. They are used
981981
by library developers who want to use logging, but want to avoid the 'No
982-
handlers could be found for logger XXX' message which can be displayed if
982+
handlers could be found for logger *XXX*' message which can be displayed if
983983
the library user has not configured logging. See :ref:`library-config` for
984984
more information.
985985

Doc/library/codecs.rst

+11-9
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,10 @@ The following error handlers can be used with all Python
345345
+-------------------------+-----------------------------------------------+
346346
| ``'backslashreplace'`` | Replace with backslashed escape sequences. |
347347
| | On encoding, use hexadecimal form of Unicode |
348-
| | code point with formats ``\xhh`` ``\uxxxx`` |
349-
| | ``\Uxxxxxxxx``. On decoding, use hexadecimal |
350-
| | form of byte value with format ``\xhh``. |
348+
| | code point with formats :samp:`\x{hh}` |
349+
| | :samp:`\u{xxxx}` :samp:`\U{xxxxxxxx}`. |
350+
| | On decoding, use hexadecimal form of byte |
351+
| | value with format :samp:`\x{hh}`. |
351352
| | Implemented in |
352353
| | :func:`backslashreplace_errors`. |
353354
+-------------------------+-----------------------------------------------+
@@ -478,8 +479,8 @@ functions:
478479

479480
Malformed data is replaced by a backslashed escape sequence.
480481
On encoding, use the hexadecimal form of Unicode code point with formats
481-
``\xhh`` ``\uxxxx`` ``\Uxxxxxxxx``. On decoding, use the hexadecimal form of
482-
byte value with format ``\xhh``.
482+
:samp:`\x{hh}` :samp:`\u{xxxx}` :samp:`\U{xxxxxxxx}`. On decoding, use the hexadecimal form of
483+
byte value with format :samp:`\x{hh}`.
483484

484485
.. versionchanged:: 3.5
485486
Works with decoding and translating.
@@ -492,7 +493,7 @@ functions:
492493

493494
The unencodable character is replaced by an appropriate XML/HTML numeric
494495
character reference, which is a decimal form of Unicode code point with
495-
format ``&#num;`` .
496+
format :samp:`&#{num};` .
496497

497498

498499
.. function:: namereplace_errors(exception)
@@ -1346,9 +1347,10 @@ encodings.
13461347
| | | supported. |
13471348
+--------------------+---------+---------------------------+
13481349
| raw_unicode_escape | | Latin-1 encoding with |
1349-
| | | ``\uXXXX`` and |
1350-
| | | ``\UXXXXXXXX`` for other |
1351-
| | | code points. Existing |
1350+
| | | :samp:`\u{XXXX}` and |
1351+
| | | :samp:`\U{XXXXXXXX}`` for |
1352+
| | | other code points. |
1353+
| | | Existing |
13521354
| | | backslashes are not |
13531355
| | | escaped in any way. |
13541356
| | | It is used in the Python |

Doc/library/http.server.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ provides three different variants:
217217
attribute holds the default values for *message* and *explain* that
218218
will be used if no value is provided; for unknown codes the default value
219219
for both is the string ``???``. The body will be empty if the method is
220-
HEAD or the response code is one of the following: ``1xx``,
220+
HEAD or the response code is one of the following: :samp:`1{xx}`,
221221
``204 No Content``, ``205 Reset Content``, ``304 Not Modified``.
222222

223223
.. versionchanged:: 3.4

Doc/library/os.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ startup by the :c:func:`PyConfig_Read` function: see
8888
On some systems, conversion using the file system encoding may fail. In this
8989
case, Python uses the :ref:`surrogateescape encoding error handler
9090
<surrogateescape>`, which means that undecodable bytes are replaced by a
91-
Unicode character U+DCxx on decoding, and these are again translated to the
92-
original byte on encoding.
91+
Unicode character U+DC\ *xx* on decoding, and these are again
92+
translated to the original byte on encoding.
9393

9494

9595
The :term:`file system encoding <filesystem encoding and error handler>` must

Doc/library/sys.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ always available.
753753

754754
Return the current value of the flags that are used for
755755
:c:func:`dlopen` calls. Symbolic names for the flag values can be
756-
found in the :mod:`os` module (``RTLD_xxx`` constants, e.g.
756+
found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, e.g.
757757
:const:`os.RTLD_LAZY`).
758758

759759
.. availability:: Unix.
@@ -1441,7 +1441,7 @@ always available.
14411441
lazy resolving of symbols when importing a module, if called as
14421442
``sys.setdlopenflags(0)``. To share symbols across extension modules, call as
14431443
``sys.setdlopenflags(os.RTLD_GLOBAL)``. Symbolic names for the flag values
1444-
can be found in the :mod:`os` module (``RTLD_xxx`` constants, e.g.
1444+
can be found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, e.g.
14451445
:const:`os.RTLD_LAZY`).
14461446

14471447
.. availability:: Unix.

Doc/library/urllib.parse.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ task isn't already covered by the URL parsing functions above.
598598

599599
.. function:: quote(string, safe='/', encoding=None, errors=None)
600600

601-
Replace special characters in *string* using the ``%xx`` escape. Letters,
601+
Replace special characters in *string* using the :samp:`%{xx}` escape. Letters,
602602
digits, and the characters ``'_.-~'`` are never quoted. By default, this
603603
function is intended for quoting the path section of a URL. The optional
604604
*safe* parameter specifies additional ASCII characters that should not be
@@ -645,7 +645,7 @@ task isn't already covered by the URL parsing functions above.
645645

646646
.. function:: unquote(string, encoding='utf-8', errors='replace')
647647

648-
Replace ``%xx`` escapes with their single-character equivalent.
648+
Replace :samp:`%{xx}` escapes with their single-character equivalent.
649649
The optional *encoding* and *errors* parameters specify how to decode
650650
percent-encoded sequences into Unicode characters, as accepted by the
651651
:meth:`bytes.decode` method.
@@ -676,7 +676,7 @@ task isn't already covered by the URL parsing functions above.
676676

677677
.. function:: unquote_to_bytes(string)
678678

679-
Replace ``%xx`` escapes with their single-octet equivalent, and return a
679+
Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return a
680680
:class:`bytes` object.
681681

682682
*string* may be either a :class:`str` or a :class:`bytes` object.

Doc/reference/lexical_analysis.rst

+42-42
Original file line numberDiff line numberDiff line change
@@ -557,51 +557,51 @@ Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string and
557557
bytes literals are interpreted according to rules similar to those used by
558558
Standard C. The recognized escape sequences are:
559559

560-
+-----------------+---------------------------------+-------+
561-
| Escape Sequence | Meaning | Notes |
562-
+=================+=================================+=======+
563-
| ``\``\ <newline>| Backslash and newline ignored | \(1) |
564-
+-----------------+---------------------------------+-------+
565-
| ``\\`` | Backslash (``\``) | |
566-
+-----------------+---------------------------------+-------+
567-
| ``\'`` | Single quote (``'``) | |
568-
+-----------------+---------------------------------+-------+
569-
| ``\"`` | Double quote (``"``) | |
570-
+-----------------+---------------------------------+-------+
571-
| ``\a`` | ASCII Bell (BEL) | |
572-
+-----------------+---------------------------------+-------+
573-
| ``\b`` | ASCII Backspace (BS) | |
574-
+-----------------+---------------------------------+-------+
575-
| ``\f`` | ASCII Formfeed (FF) | |
576-
+-----------------+---------------------------------+-------+
577-
| ``\n`` | ASCII Linefeed (LF) | |
578-
+-----------------+---------------------------------+-------+
579-
| ``\r`` | ASCII Carriage Return (CR) | |
580-
+-----------------+---------------------------------+-------+
581-
| ``\t`` | ASCII Horizontal Tab (TAB) | |
582-
+-----------------+---------------------------------+-------+
583-
| ``\v`` | ASCII Vertical Tab (VT) | |
584-
+-----------------+---------------------------------+-------+
585-
| ``\ooo`` | Character with octal value | (2,4) |
586-
| | *ooo* | |
587-
+-----------------+---------------------------------+-------+
588-
| ``\xhh`` | Character with hex value *hh* | (3,4) |
589-
+-----------------+---------------------------------+-------+
560+
+----------------------+---------------------------------+-------+
561+
| Escape Sequence | Meaning | Notes |
562+
+======================+=================================+=======+
563+
| ``\``\ <newline> | Backslash and newline ignored | \(1) |
564+
+----------------------+---------------------------------+-------+
565+
| ``\\`` | Backslash (``\``) | |
566+
+----------------------+---------------------------------+-------+
567+
| ``\'`` | Single quote (``'``) | |
568+
+----------------------+---------------------------------+-------+
569+
| ``\"`` | Double quote (``"``) | |
570+
+----------------------+---------------------------------+-------+
571+
| ``\a`` | ASCII Bell (BEL) | |
572+
+----------------------+---------------------------------+-------+
573+
| ``\b`` | ASCII Backspace (BS) | |
574+
+----------------------+---------------------------------+-------+
575+
| ``\f`` | ASCII Formfeed (FF) | |
576+
+----------------------+---------------------------------+-------+
577+
| ``\n`` | ASCII Linefeed (LF) | |
578+
+----------------------+---------------------------------+-------+
579+
| ``\r`` | ASCII Carriage Return (CR) | |
580+
+----------------------+---------------------------------+-------+
581+
| ``\t`` | ASCII Horizontal Tab (TAB) | |
582+
+----------------------+---------------------------------+-------+
583+
| ``\v`` | ASCII Vertical Tab (VT) | |
584+
+----------------------+---------------------------------+-------+
585+
| :samp:`\{ooo}` | Character with octal value | (2,4) |
586+
| | *ooo* | |
587+
+----------------------+---------------------------------+-------+
588+
| :samp:`\x{hh}` | Character with hex value *hh* | (3,4) |
589+
+----------------------+---------------------------------+-------+
590590

591591
Escape sequences only recognized in string literals are:
592592

593-
+-----------------+---------------------------------+-------+
594-
| Escape Sequence | Meaning | Notes |
595-
+=================+=================================+=======+
596-
| ``\N{name}`` | Character named *name* in the | \(5) |
597-
| | Unicode database | |
598-
+-----------------+---------------------------------+-------+
599-
| ``\uxxxx`` | Character with 16-bit hex value | \(6) |
600-
| | *xxxx* | |
601-
+-----------------+---------------------------------+-------+
602-
| ``\Uxxxxxxxx`` | Character with 32-bit hex value | \(7) |
603-
| | *xxxxxxxx* | |
604-
+-----------------+---------------------------------+-------+
593+
+----------------------+---------------------------------+-------+
594+
| Escape Sequence | Meaning | Notes |
595+
+======================+=================================+=======+
596+
| ``\N{name}`` | Character named *name* in the | \(5) |
597+
| | Unicode database | |
598+
+----------------------+---------------------------------+-------+
599+
| :samp:`\u{xxxx}` | Character with 16-bit hex value | \(6) |
600+
| | *xxxx* | |
601+
+----------------------+---------------------------------+-------+
602+
| :samp:`\U{xxxxxxxx}` | Character with 32-bit hex value | \(7) |
603+
| | *xxxxxxxx* | |
604+
+----------------------+---------------------------------+-------+
605605

606606
Notes:
607607

Doc/using/configure.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ differently depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:
10121012
* Use ``Py_IMPORTED_SYMBOL`` otherwise.
10131013

10141014
If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension
1015-
built as a shared library, its ``PyInit_xxx()`` function is not exported,
1015+
built as a shared library, its :samp:`PyInit_{xxx}()` function is not exported,
10161016
causing an :exc:`ImportError` on import.
10171017

10181018

Doc/using/windows.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ non-standard paths in the registry and user site-packages.
11921192

11931193
* Adds ``._pth`` file support and removes ``applocal`` option from
11941194
``pyvenv.cfg``.
1195-
* Adds ``pythonXX.zip`` as a potential landmark when directly adjacent
1195+
* Adds :file:`python{XX}.zip` as a potential landmark when directly adjacent
11961196
to the executable.
11971197

11981198
.. deprecated::

Doc/whatsnew/2.0.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ Lundh. A detailed explanation of the interface was written up as :pep:`100`,
153153
significant points about the Unicode interfaces.
154154

155155
In Python source code, Unicode strings are written as ``u"string"``. Arbitrary
156-
Unicode characters can be written using a new escape sequence, ``\uHHHH``, where
156+
Unicode characters can be written using a new escape sequence, :samp:`\u{HHHH}`, where
157157
*HHHH* is a 4-digit hexadecimal number from 0000 to FFFF. The existing
158-
``\xHHHH`` escape sequence can also be used, and octal escapes can be used for
158+
:samp:`\x{HH}` escape sequence can also be used, and octal escapes can be used for
159159
characters up to U+01FF, which is represented by ``\777``.
160160

161161
Unicode strings, just like regular strings, are an immutable sequence type.

Doc/whatsnew/2.6.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ and to C extension code as :c:data:`!Py_Py3kWarningFlag`.
125125

126126
.. seealso::
127127

128-
The 3xxx series of PEPs, which contains proposals for Python 3.0.
128+
The 3\ *xxx* series of PEPs, which contains proposals for Python 3.0.
129129
:pep:`3000` describes the development process for Python 3.0.
130130
Start with :pep:`3100` that describes the general goals for Python
131131
3.0, and then explore the higher-numbered PEPS that propose

Doc/whatsnew/3.3.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,7 @@ The :pep:`418` added new functions to the :mod:`time` module:
20672067
Other new functions:
20682068

20692069
* :func:`~time.clock_getres`, :func:`~time.clock_gettime` and
2070-
:func:`~time.clock_settime` functions with ``CLOCK_xxx`` constants.
2070+
:func:`~time.clock_settime` functions with :samp:`CLOCK_{xxx}` constants.
20712071
(Contributed by Victor Stinner in :issue:`10278`.)
20722072

20732073
To improve cross platform consistency, :func:`~time.sleep` now raises a

Doc/whatsnew/3.4.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2085,7 +2085,7 @@ Deprecations in the Python API
20852085
:meth:`importlib.abc.MetaPathFinder.find_spec`;
20862086
:meth:`!importlib.abc.PathEntryFinder.find_loader` and
20872087
:meth:`!find_module` are replaced by
2088-
:meth:`importlib.abc.PathEntryFinder.find_spec`; all of the ``xxxLoader`` ABC
2088+
:meth:`importlib.abc.PathEntryFinder.find_spec`; all of the :samp:`{xxx}Loader` ABC
20892089
``load_module`` methods (:meth:`!importlib.abc.Loader.load_module`,
20902090
:meth:`!importlib.abc.InspectLoader.load_module`,
20912091
:meth:`!importlib.abc.FileLoader.load_module`,

Misc/NEWS.d/3.12.0a2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The IDNA codec decoder used on DNS hostnames by :mod:`socket` or
88
:mod:`asyncio` related name resolution functions no longer involves a
99
quadratic algorithm. This prevents a potential CPU denial of service if an
1010
out-of-spec excessive length hostname involving bidirectional characters
11-
were decoded. Some protocols such as :mod:`urllib` http ``3xx`` redirects
11+
were decoded. Some protocols such as :mod:`urllib` http :samp:`3{xx}` redirects
1212
potentially allow for an attacker to supply such a name.
1313

1414
Individual labels within an IDNA encoded DNS name will now raise an error

Misc/NEWS.d/3.12.0a3.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ within a garbage request to be printed to the stderr server log.
99

1010
This is done by changing the :mod:`http.server`
1111
:class:`BaseHTTPRequestHandler` ``.log_message`` method to replace control
12-
characters with a ``\xHH`` hex escape before printing.
12+
characters with a :samp:`\x{HH}` hex escape before printing.
1313

1414
..
1515

Misc/NEWS.d/3.5.0rc1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Sanad Zaki Rizvi.
168168
169169
Idle editor default font. Switch from Courier to platform-sensitive
170170
TkFixedFont. This should not affect current customized font selections. If
171-
there is a problem, edit $HOME/.idlerc/config-main.cfg and remove 'fontxxx'
171+
there is a problem, edit $HOME/.idlerc/config-main.cfg and remove ':samp:`font{xxx}`'
172172
entries from [Editor Window]. Patch by Mark Roseman.
173173

174174
..

Misc/NEWS.d/3.5.1rc1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ comprehensions correspond to the opening brace.
189189
.. nonce: 0Gh-Ty
190190
.. section: Core and Builtins
191191
192-
Hide the private _Py_atomic_xxx symbols from the public Python.h header to
192+
Hide the private :samp:`_Py_atomic_{xxx}` symbols from the public Python.h header to
193193
fix a compilation error with OpenMP. PyThreadState_GET() becomes an alias to
194194
PyThreadState_Get() to avoid ABI incompatibilities.
195195

Misc/NEWS.d/3.8.0a1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8253,7 +8253,7 @@ Explain how IDLE's Shell displays output.
82538253
82548254
Improve the doc about IDLE running user code. The section is renamed from
82558255
"IDLE -- console differences" is renamed "Running user code". It mostly
8256-
covers the implications of using custom sys.stdxxx objects.
8256+
covers the implications of using custom :samp:sys.std{xxx}` objects.
82578257

82588258
..
82598259

Misc/NEWS.d/3.8.0a4.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ on the ABI.
10871087
Change ``PyAPI_FUNC(type)``, ``PyAPI_DATA(type)`` and ``PyMODINIT_FUNC``
10881088
macros of ``pyport.h`` when ``Py_BUILD_CORE_MODULE`` is defined. The
10891089
``Py_BUILD_CORE_MODULE`` define must be now be used to build a C extension
1090-
as a dynamic library accessing Python internals: export the PyInit_xxx()
1090+
as a dynamic library accessing Python internals: export the :samp:`PyInit_{xxx}()`
10911091
function in DLL exports on Windows.
10921092

10931093
..

Misc/NEWS.d/3.9.0a1.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -4118,7 +4118,7 @@ Add tests for ROT-13 codec.
41184118
.. nonce: Zoe9ek
41194119
.. section: Tests
41204120
4121-
Added tests for PyDateTime_xxx_GET_xxx() macros of the C API of the
4121+
Added tests for :samp:`PyDateTime_{xxx}_GET_{xxx}()` macros of the C API of the
41224122
:mod:`datetime` module. Patch by Joannah Nanjekye.
41234123

41244124
..
@@ -4576,7 +4576,7 @@ distutils bdist_wininst: bdist_wininst only works on Windows.
45764576
.. nonce: j5ebdT
45774577
.. section: Build
45784578
4579-
Many ``PyRun_XXX()`` functions like :c:func:`PyRun_String` were no longer
4579+
Many :samp:`PyRun_{XXX}()` functions like :c:func:`PyRun_String` were no longer
45804580
exported in ``libpython38.dll`` by mistake. Export them again to fix the ABI
45814581
compatibility.
45824582

0 commit comments

Comments
 (0)