Skip to content

Commit 799e7bb

Browse files
committed
gh-139257: docutils 0.22 support
Escape things that look like Roman numerals. Docutils 0.22 includes a new roman-numeral interpreter that falls over some of our content. Escape anything that causes trouble. Python itself isn't using docutils 0.22 yet for its doc generation, but some Linux distributions have updated to it.
1 parent 0344db8 commit 799e7bb

File tree

8 files changed

+33
-32
lines changed

8 files changed

+33
-32
lines changed

Doc/faq/design.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ Why does Python use methods for some functionality (e.g. list.index()) but funct
170170

171171
As Guido said:
172172

173-
(a) For some operations, prefix notation just reads better than
173+
\(a) For some operations, prefix notation just reads better than
174174
postfix -- prefix (and infix!) operations have a long tradition in
175175
mathematics which likes notations where the visuals help the
176176
mathematician thinking about a problem. Compare the easy with which we
177177
rewrite a formula like x*(a+b) into x*a + x*b to the clumsiness of
178178
doing the same thing using a raw OO notation.
179179

180-
(b) When I read code that says len(x) I *know* that it is asking for
180+
\(b) When I read code that says len(x) I *know* that it is asking for
181181
the length of something. This tells me two things: the result is an
182182
integer, and the argument is some kind of container. To the contrary,
183183
when I read x.len(), I have to already know that x is some kind of

Doc/howto/functional.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Functional Programming HOWTO
55
********************************
66

7-
:Author: A. M. Kuchling
7+
:Author: A\. M. Kuchling
88
:Release: 0.32
99

1010
In this document, we'll take a tour of Python's features suitable for

Doc/library/decimal.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,20 +2100,20 @@ to work with the :class:`Decimal` class::
21002100
Decimal FAQ
21012101
-----------
21022102

2103-
Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to
2103+
Q\. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to
21042104
minimize typing when using the interactive interpreter?
21052105

2106-
A. Some users abbreviate the constructor to just a single letter:
2106+
A\. Some users abbreviate the constructor to just a single letter:
21072107

21082108
>>> D = decimal.Decimal
21092109
>>> D('1.23') + D('3.45')
21102110
Decimal('4.68')
21112111

2112-
Q. In a fixed-point application with two decimal places, some inputs have many
2112+
Q\. In a fixed-point application with two decimal places, some inputs have many
21132113
places and need to be rounded. Others are not supposed to have excess digits
21142114
and need to be validated. What methods should be used?
21152115

2116-
A. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal places. If
2116+
A\. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal places. If
21172117
the :const:`Inexact` trap is set, it is also useful for validation:
21182118

21192119
>>> TWOPLACES = Decimal(10) ** -2 # same as Decimal('0.01')
@@ -2131,10 +2131,10 @@ the :const:`Inexact` trap is set, it is also useful for validation:
21312131
...
21322132
Inexact: None
21332133

2134-
Q. Once I have valid two place inputs, how do I maintain that invariant
2134+
Q\. Once I have valid two place inputs, how do I maintain that invariant
21352135
throughout an application?
21362136

2137-
A. Some operations like addition, subtraction, and multiplication by an integer
2137+
A\. Some operations like addition, subtraction, and multiplication by an integer
21382138
will automatically preserve fixed point. Others operations, like division and
21392139
non-integer multiplication, will change the number of decimal places and need to
21402140
be followed-up with a :meth:`~Decimal.quantize` step:
@@ -2166,21 +2166,21 @@ to handle the :meth:`~Decimal.quantize` step:
21662166
>>> div(b, a)
21672167
Decimal('0.03')
21682168

2169-
Q. There are many ways to express the same value. The numbers ``200``,
2169+
Q\. There are many ways to express the same value. The numbers ``200``,
21702170
``200.000``, ``2E2``, and ``.02E+4`` all have the same value at
21712171
various precisions. Is there a way to transform them to a single recognizable
21722172
canonical value?
21732173

2174-
A. The :meth:`~Decimal.normalize` method maps all equivalent values to a single
2174+
A\. The :meth:`~Decimal.normalize` method maps all equivalent values to a single
21752175
representative:
21762176

21772177
>>> values = map(Decimal, '200 200.000 2E2 .02E+4'.split())
21782178
>>> [v.normalize() for v in values]
21792179
[Decimal('2E+2'), Decimal('2E+2'), Decimal('2E+2'), Decimal('2E+2')]
21802180

2181-
Q. When does rounding occur in a computation?
2181+
Q\. When does rounding occur in a computation?
21822182

2183-
A. It occurs *after* the computation. The philosophy of the decimal
2183+
A\. It occurs *after* the computation. The philosophy of the decimal
21842184
specification is that numbers are considered exact and are created
21852185
independent of the current context. They can even have greater
21862186
precision than current context. Computations process with those
@@ -2198,10 +2198,10 @@ applied to the *result* of the computation::
21982198
>>> pi + 0 - Decimal('0.00005'). # Intermediate values are rounded
21992199
Decimal('3.1416')
22002200

2201-
Q. Some decimal values always print with exponential notation. Is there a way
2201+
Q\. Some decimal values always print with exponential notation. Is there a way
22022202
to get a non-exponential representation?
22032203

2204-
A. For some values, exponential notation is the only way to express the number
2204+
A\. For some values, exponential notation is the only way to express the number
22052205
of significant places in the coefficient. For example, expressing
22062206
``5.0E+3`` as ``5000`` keeps the value constant but cannot show the
22072207
original's two-place significance.
@@ -2216,9 +2216,9 @@ value unchanged:
22162216
>>> remove_exponent(Decimal('5E+3'))
22172217
Decimal('5000')
22182218

2219-
Q. Is there a way to convert a regular float to a :class:`Decimal`?
2219+
Q\. Is there a way to convert a regular float to a :class:`Decimal`?
22202220

2221-
A. Yes, any binary floating-point number can be exactly expressed as a
2221+
A\. Yes, any binary floating-point number can be exactly expressed as a
22222222
Decimal though an exact conversion may take more precision than intuition would
22232223
suggest:
22242224

@@ -2227,19 +2227,19 @@ suggest:
22272227
>>> Decimal(math.pi)
22282228
Decimal('3.141592653589793115997963468544185161590576171875')
22292229

2230-
Q. Within a complex calculation, how can I make sure that I haven't gotten a
2230+
Q\. Within a complex calculation, how can I make sure that I haven't gotten a
22312231
spurious result because of insufficient precision or rounding anomalies.
22322232

2233-
A. The decimal module makes it easy to test results. A best practice is to
2233+
A\. The decimal module makes it easy to test results. A best practice is to
22342234
re-run calculations using greater precision and with various rounding modes.
22352235
Widely differing results indicate insufficient precision, rounding mode issues,
22362236
ill-conditioned inputs, or a numerically unstable algorithm.
22372237

2238-
Q. I noticed that context precision is applied to the results of operations but
2238+
Q\. I noticed that context precision is applied to the results of operations but
22392239
not to the inputs. Is there anything to watch out for when mixing values of
22402240
different precisions?
22412241

2242-
A. Yes. The principle is that all values are considered to be exact and so is
2242+
A\. Yes. The principle is that all values are considered to be exact and so is
22432243
the arithmetic on those values. Only the results are rounded. The advantage
22442244
for inputs is that "what you type is what you get". A disadvantage is that the
22452245
results can look odd if you forget that the inputs haven't been rounded:
@@ -2267,9 +2267,9 @@ Alternatively, inputs can be rounded upon creation using the
22672267
>>> Context(prec=5, rounding=ROUND_DOWN).create_decimal('1.2345678')
22682268
Decimal('1.2345')
22692269

2270-
Q. Is the CPython implementation fast for large numbers?
2270+
Q\. Is the CPython implementation fast for large numbers?
22712271

2272-
A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of
2272+
A\. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of
22732273
the decimal module integrate the high speed `libmpdec
22742274
<https://www.bytereef.org/mpdecimal/doc/libmpdec/index.html>`_ library for
22752275
arbitrary precision correctly rounded decimal floating-point arithmetic [#]_.

Doc/library/random.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ from sources provided by the operating system.
4949

5050
.. seealso::
5151

52-
M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally
52+
M\. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally
5353
equidistributed uniform pseudorandom number generator", ACM Transactions on
5454
Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998.
5555

Doc/library/ssl.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,13 +2961,13 @@ of TLS/SSL. Some new TLS 1.3 features are not yet available.
29612961
Donald E., Jeffrey I. Schiller
29622962

29632963
:rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile <5280>`
2964-
D. Cooper
2964+
D\. Cooper
29652965

29662966
:rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 <5246>`
2967-
T. Dierks et. al.
2967+
T\. Dierks et. al.
29682968

29692969
:rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`
2970-
D. Eastlake
2970+
D\. Eastlake
29712971

29722972
`IANA TLS: Transport Layer Security (TLS) Parameters <https://www.iana.org/assignments/tls-parameters/tls-parameters.xml>`_
29732973
IANA

Doc/reference/compound_stmts.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ subject value:
11221122
If only keyword patterns are present, they are processed as follows,
11231123
one by one:
11241124

1125-
I. The keyword is looked up as an attribute on the subject.
1125+
I\. The keyword is looked up as an attribute on the subject.
11261126

11271127
* If this raises an exception other than :exc:`AttributeError`, the
11281128
exception bubbles up.
@@ -1134,13 +1134,13 @@ subject value:
11341134
pattern fails; if this succeeds, the match proceeds to the next keyword.
11351135

11361136

1137-
II. If all keyword patterns succeed, the class pattern succeeds.
1137+
II\. If all keyword patterns succeed, the class pattern succeeds.
11381138

11391139
If any positional patterns are present, they are converted to keyword
11401140
patterns using the :data:`~object.__match_args__` attribute on the class
11411141
``name_or_attr`` before matching:
11421142

1143-
I. The equivalent of ``getattr(cls, "__match_args__", ())`` is called.
1143+
I\. The equivalent of ``getattr(cls, "__match_args__", ())`` is called.
11441144

11451145
* If this raises an exception, the exception bubbles up.
11461146

@@ -1158,7 +1158,7 @@ subject value:
11581158

11591159
.. seealso:: :ref:`class-pattern-matching`
11601160

1161-
II. Once all positional patterns have been converted to keyword patterns,
1161+
II\. Once all positional patterns have been converted to keyword patterns,
11621162
the match proceeds as if there were only keyword patterns.
11631163

11641164
For the following built-in types the handling of positional subpatterns is

Doc/whatsnew/3.4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
What's New In Python 3.4
33
****************************
44

5-
:Author: R. David Murray <[email protected]> (Editor)
5+
:Author: R\. David Murray <[email protected]> (Editor)
66

77
.. Rules for maintenance:
88
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support building the documentation with docutils >= 0.22.

0 commit comments

Comments
 (0)