From cc4271627552d426102fd55ae201ae572811130a Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 21 Jun 2022 10:50:47 -0700 Subject: [PATCH] =?UTF-8?q?gh-86986:=20=EF=BB=BF=EF=BB=BFDrop=20compatibil?= =?UTF-8?q?ity=20support=20for=20Sphinx=202=20(GH-93737)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "bpo-42843: Keep Sphinx 1.8 and Sphinx 2 compatibility (GH-24282)" This reverts commit 5c1f15b4b1024cbf0acc85832f0c623d1a4605fd * Revert "bpo-42579: Make workaround for various versions of Sphinx more robust (GH-23662)" This reverts commit b63a620014b67a6e63d10783149c41baaf59def8. (cherry picked from commit 0efe3a1636c143fe0694a8e4d25d6eae19e0d618) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Doc/conf.py | 2 -- Doc/library/asyncio-stream.rst | 2 +- Doc/library/base64.rst | 2 +- Doc/library/difflib.rst | 6 ++--- Doc/library/email.header.rst | 2 +- Doc/library/functions.rst | 2 +- Doc/library/http.cookies.rst | 2 +- Doc/library/io.rst | 2 +- Doc/library/xml.dom.minidom.rst | 2 +- Doc/tools/extensions/pyspecific.py | 7 +---- Doc/tools/extensions/suspicious.py | 41 +++++------------------------- 11 files changed, 18 insertions(+), 52 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 46cbab2780c8d9..0c7deb59d130dc 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -237,5 +237,3 @@ # bpo-40204: Disable warnings on Sphinx 2 syntax of the C domain since the # documentation is built with -W (warnings treated as errors). c_warn_on_allowed_pre_v3 = False - -strip_signature_backslash = True diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst index 97431d103cf4ba..9b468670a2521e 100644 --- a/Doc/library/asyncio-stream.rst +++ b/Doc/library/asyncio-stream.rst @@ -192,7 +192,7 @@ StreamReader can be read. Use the :attr:`IncompleteReadError.partial` attribute to get the partially read data. - .. coroutinemethod:: readuntil(separator=b'\\n') + .. coroutinemethod:: readuntil(separator=b'\n') Read data from the stream until *separator* is found. diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst index 4ff038c8d29f1a..a02ba739146aaf 100644 --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -201,7 +201,7 @@ The modern interface provides: .. versionadded:: 3.4 -.. function:: a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \\t\\n\\r\\v') +.. function:: a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v') Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and return the decoded :class:`bytes`. diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst index aa08988c8b36f7..a5ee0fb5389793 100644 --- a/Doc/library/difflib.rst +++ b/Doc/library/difflib.rst @@ -149,7 +149,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module. contains a good example of its use. -.. function:: context_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\\n') +.. function:: context_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n') Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in context diff format. @@ -279,7 +279,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module. emu -.. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\\n') +.. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n') Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in unified diff format. @@ -321,7 +321,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module. See :ref:`difflib-interface` for a more detailed example. -.. function:: diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'', fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\\n') +.. function:: diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'', fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n') Compare *a* and *b* (lists of bytes objects) using *dfunc*; yield a sequence of delta lines (also bytes) in the format returned by *dfunc*. diff --git a/Doc/library/email.header.rst b/Doc/library/email.header.rst index 07152c224f2ff0..e093f138936b36 100644 --- a/Doc/library/email.header.rst +++ b/Doc/library/email.header.rst @@ -116,7 +116,7 @@ Here is the :class:`Header` class description: if *s* is a byte string. - .. method:: encode(splitchars=';, \\t', maxlinelen=None, linesep='\\n') + .. method:: encode(splitchars=';, \t', maxlinelen=None, linesep='\n') Encode a message header into an RFC-compliant format, possibly wrapping long lines and encapsulating non-ASCII parts in base64 or quoted-printable diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index f5e4c1a8640f45..da7de18722f87e 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1393,7 +1393,7 @@ are always available. They are listed here in alphabetical order. supported. -.. function:: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False) +.. function:: print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) Print *objects* to the text stream *file*, separated by *sep* and followed by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as keyword diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst index 17792b200599bd..a2c1eb00d8b33d 100644 --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -93,7 +93,7 @@ Cookie Objects :meth:`value_decode` are inverses on the range of *value_decode*. -.. method:: BaseCookie.output(attrs=None, header='Set-Cookie:', sep='\\r\\n') +.. method:: BaseCookie.output(attrs=None, header='Set-Cookie:', sep='\r\n') Return a string representation suitable to be sent as HTTP headers. *attrs* and *header* are sent to each :class:`Morsel`'s :meth:`output` method. *sep* is used diff --git a/Doc/library/io.rst b/Doc/library/io.rst index d8e7b1621e2ea8..753e6c1e3b9b46 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -1042,7 +1042,7 @@ Text I/O The method supports ``encoding="locale"`` option. -.. class:: StringIO(initial_value='', newline='\\n') +.. class:: StringIO(initial_value='', newline='\n') A text stream using an in-memory text buffer. It inherits :class:`TextIOBase`. diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst index 20984b98b1778c..076cf34694ce4e 100644 --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -180,7 +180,7 @@ module documentation. This section lists the differences between the API and .. versionchanged:: 3.9 The *standalone* parameter was added. -.. method:: Node.toprettyxml(indent="\\t", newl="\\n", encoding=None, \ +.. method:: Node.toprettyxml(indent="\t", newl="\n", encoding=None, \ standalone=None) Return a pretty-printed version of the document. *indent* specifies the diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py index bdcfe9ac1c23dd..9f8446ce52891d 100644 --- a/Doc/tools/extensions/pyspecific.py +++ b/Doc/tools/extensions/pyspecific.py @@ -418,12 +418,7 @@ def run(self): translatable=False) node.append(para) env = self.state.document.settings.env - # deprecated pre-Sphinx-2 method - if hasattr(env, 'note_versionchange'): - env.note_versionchange('deprecated', version[0], node, self.lineno) - # new method - else: - env.get_domain('changeset').note_changeset(node) + env.get_domain('changeset').note_changeset(node) return [node] + messages diff --git a/Doc/tools/extensions/suspicious.py b/Doc/tools/extensions/suspicious.py index c3de4d79c83f87..2d581a8a6c3db6 100644 --- a/Doc/tools/extensions/suspicious.py +++ b/Doc/tools/extensions/suspicious.py @@ -44,7 +44,6 @@ import os import re import csv -import sys from docutils import nodes from sphinx.builders import Builder @@ -55,9 +54,7 @@ :[a-zA-Z][a-zA-Z0-9]+| # :foo `| # ` (seldom used by itself) (?= (3, 0) + ''', re.VERBOSE).finditer class Rule: @@ -152,32 +149,15 @@ def is_ignored(self, line, lineno, issue): def report_issue(self, text, lineno, issue): self.any_issue = True self.write_log_entry(lineno, issue, text) - if py3: - self.logger.warning('[%s:%d] "%s" found in "%-.120s"' % + self.logger.warning('[%s:%d] "%s" found in "%-.120s"' % (self.docname, lineno, issue, text)) - else: - self.logger.warning( - '[%s:%d] "%s" found in "%-.120s"' % ( - self.docname.encode(sys.getdefaultencoding(),'replace'), - lineno, - issue.encode(sys.getdefaultencoding(),'replace'), - text.strip().encode(sys.getdefaultencoding(),'replace'))) self.app.statuscode = 1 def write_log_entry(self, lineno, issue, text): - if py3: - f = open(self.log_file_name, 'a') - writer = csv.writer(f, dialect) - writer.writerow([self.docname, lineno, issue, text.strip()]) - f.close() - else: - f = open(self.log_file_name, 'ab') - writer = csv.writer(f, dialect) - writer.writerow([self.docname.encode('utf-8'), - lineno, - issue.encode('utf-8'), - text.strip().encode('utf-8')]) - f.close() + f = open(self.log_file_name, 'a') + writer = csv.writer(f, dialect) + writer.writerow([self.docname, lineno, issue, text.strip()]) + f.close() def load_rules(self, filename): """Load database of previously ignored issues. @@ -188,10 +168,7 @@ def load_rules(self, filename): self.logger.info("loading ignore rules... ", nonl=1) self.rules = rules = [] try: - if py3: - f = open(filename, 'r') - else: - f = open(filename, 'rb') + f = open(filename, 'r') except IOError: return for i, row in enumerate(csv.reader(f)): @@ -203,10 +180,6 @@ def load_rules(self, filename): lineno = int(lineno) else: lineno = None - if not py3: - docname = docname.decode('utf-8') - issue = issue.decode('utf-8') - text = text.decode('utf-8') rule = Rule(docname, lineno, issue, text) rules.append(rule) f.close()