Skip to content

Commit 223fde3

Browse files
gh-86986: Drop compatibility support for Sphinx 2 (GH-93737)
* Revert "bpo-42843: Keep Sphinx 1.8 and Sphinx 2 compatibility (GH-24282)" This reverts commit 5c1f15b * Revert "bpo-42579: Make workaround for various versions of Sphinx more robust (GH-23662)" This reverts commit b63a620. (cherry picked from commit 0efe3a1) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent 2454dbe commit 223fde3

11 files changed

+18
-52
lines changed

Doc/conf.py

-2
Original file line numberDiff line numberDiff line change
@@ -239,5 +239,3 @@
239239
# bpo-40204: Disable warnings on Sphinx 2 syntax of the C domain since the
240240
# documentation is built with -W (warnings treated as errors).
241241
c_warn_on_allowed_pre_v3 = False
242-
243-
strip_signature_backslash = True

Doc/library/asyncio-stream.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ StreamReader
192192
can be read. Use the :attr:`IncompleteReadError.partial`
193193
attribute to get the partially read data.
194194

195-
.. coroutinemethod:: readuntil(separator=b'\\n')
195+
.. coroutinemethod:: readuntil(separator=b'\n')
196196

197197
Read data from the stream until *separator* is found.
198198

Doc/library/base64.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ The modern interface provides:
199199
.. versionadded:: 3.4
200200

201201

202-
.. function:: a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \\t\\n\\r\\v')
202+
.. function:: a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v')
203203

204204
Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and
205205
return the decoded :class:`bytes`.

Doc/library/difflib.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
149149
contains a good example of its use.
150150

151151

152-
.. function:: context_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\\n')
152+
.. function:: context_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n')
153153

154154
Compare *a* and *b* (lists of strings); return a delta (a :term:`generator`
155155
generating the delta lines) in context diff format.
@@ -279,7 +279,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
279279
emu
280280

281281

282-
.. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\\n')
282+
.. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n')
283283

284284
Compare *a* and *b* (lists of strings); return a delta (a :term:`generator`
285285
generating the delta lines) in unified diff format.
@@ -321,7 +321,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
321321

322322
See :ref:`difflib-interface` for a more detailed example.
323323

324-
.. function:: diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'', fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\\n')
324+
.. function:: diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'', fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n')
325325

326326
Compare *a* and *b* (lists of bytes objects) using *dfunc*; yield a
327327
sequence of delta lines (also bytes) in the format returned by *dfunc*.

Doc/library/email.header.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Here is the :class:`Header` class description:
116116
if *s* is a byte string.
117117

118118

119-
.. method:: encode(splitchars=';, \\t', maxlinelen=None, linesep='\\n')
119+
.. method:: encode(splitchars=';, \t', maxlinelen=None, linesep='\n')
120120

121121
Encode a message header into an RFC-compliant format, possibly wrapping
122122
long lines and encapsulating non-ASCII parts in base64 or quoted-printable

Doc/library/functions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ are always available. They are listed here in alphabetical order.
13871387
supported.
13881388

13891389

1390-
.. function:: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False)
1390+
.. function:: print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
13911391

13921392
Print *objects* to the text stream *file*, separated by *sep* and followed
13931393
by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as keyword

Doc/library/http.cookies.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Cookie Objects
9393
:meth:`value_decode` are inverses on the range of *value_decode*.
9494

9595

96-
.. method:: BaseCookie.output(attrs=None, header='Set-Cookie:', sep='\\r\\n')
96+
.. method:: BaseCookie.output(attrs=None, header='Set-Cookie:', sep='\r\n')
9797

9898
Return a string representation suitable to be sent as HTTP headers. *attrs* and
9999
*header* are sent to each :class:`Morsel`'s :meth:`output` method. *sep* is used

Doc/library/io.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ Text I/O
10351035
.. versionadded:: 3.7
10361036

10371037

1038-
.. class:: StringIO(initial_value='', newline='\\n')
1038+
.. class:: StringIO(initial_value='', newline='\n')
10391039

10401040
A text stream using an in-memory text buffer. It inherits
10411041
:class:`TextIOBase`.

Doc/library/xml.dom.minidom.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ module documentation. This section lists the differences between the API and
180180
.. versionchanged:: 3.9
181181
The *standalone* parameter was added.
182182

183-
.. method:: Node.toprettyxml(indent="\\t", newl="\\n", encoding=None, \
183+
.. method:: Node.toprettyxml(indent="\t", newl="\n", encoding=None, \
184184
standalone=None)
185185

186186
Return a pretty-printed version of the document. *indent* specifies the

Doc/tools/extensions/pyspecific.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,7 @@ def run(self):
418418
translatable=False)
419419
node.append(para)
420420
env = self.state.document.settings.env
421-
# deprecated pre-Sphinx-2 method
422-
if hasattr(env, 'note_versionchange'):
423-
env.note_versionchange('deprecated', version[0], node, self.lineno)
424-
# new method
425-
else:
426-
env.get_domain('changeset').note_changeset(node)
421+
env.get_domain('changeset').note_changeset(node)
427422
return [node] + messages
428423

429424

Doc/tools/extensions/suspicious.py

+7-34
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import os
4545
import re
4646
import csv
47-
import sys
4847

4948
from docutils import nodes
5049
from sphinx.builders import Builder
@@ -55,9 +54,7 @@
5554
:[a-zA-Z][a-zA-Z0-9]+| # :foo
5655
`| # ` (seldom used by itself)
5756
(?<!\.)\.\.[ \t]*\w+: # .. foo: (but NOT ... else:)
58-
''', re.UNICODE | re.VERBOSE).finditer
59-
60-
py3 = sys.version_info >= (3, 0)
57+
''', re.VERBOSE).finditer
6158

6259

6360
class Rule:
@@ -152,32 +149,15 @@ def is_ignored(self, line, lineno, issue):
152149
def report_issue(self, text, lineno, issue):
153150
self.any_issue = True
154151
self.write_log_entry(lineno, issue, text)
155-
if py3:
156-
self.logger.warning('[%s:%d] "%s" found in "%-.120s"' %
152+
self.logger.warning('[%s:%d] "%s" found in "%-.120s"' %
157153
(self.docname, lineno, issue, text))
158-
else:
159-
self.logger.warning(
160-
'[%s:%d] "%s" found in "%-.120s"' % (
161-
self.docname.encode(sys.getdefaultencoding(),'replace'),
162-
lineno,
163-
issue.encode(sys.getdefaultencoding(),'replace'),
164-
text.strip().encode(sys.getdefaultencoding(),'replace')))
165154
self.app.statuscode = 1
166155

167156
def write_log_entry(self, lineno, issue, text):
168-
if py3:
169-
f = open(self.log_file_name, 'a')
170-
writer = csv.writer(f, dialect)
171-
writer.writerow([self.docname, lineno, issue, text.strip()])
172-
f.close()
173-
else:
174-
f = open(self.log_file_name, 'ab')
175-
writer = csv.writer(f, dialect)
176-
writer.writerow([self.docname.encode('utf-8'),
177-
lineno,
178-
issue.encode('utf-8'),
179-
text.strip().encode('utf-8')])
180-
f.close()
157+
f = open(self.log_file_name, 'a')
158+
writer = csv.writer(f, dialect)
159+
writer.writerow([self.docname, lineno, issue, text.strip()])
160+
f.close()
181161

182162
def load_rules(self, filename):
183163
"""Load database of previously ignored issues.
@@ -188,10 +168,7 @@ def load_rules(self, filename):
188168
self.logger.info("loading ignore rules... ", nonl=1)
189169
self.rules = rules = []
190170
try:
191-
if py3:
192-
f = open(filename, 'r')
193-
else:
194-
f = open(filename, 'rb')
171+
f = open(filename, 'r')
195172
except IOError:
196173
return
197174
for i, row in enumerate(csv.reader(f)):
@@ -203,10 +180,6 @@ def load_rules(self, filename):
203180
lineno = int(lineno)
204181
else:
205182
lineno = None
206-
if not py3:
207-
docname = docname.decode('utf-8')
208-
issue = issue.decode('utf-8')
209-
text = text.decode('utf-8')
210183
rule = Rule(docname, lineno, issue, text)
211184
rules.append(rule)
212185
f.close()

0 commit comments

Comments
 (0)