[Python-checkins] bpo-42579: Make workaround for various versions of Sphinx more robust (GH-23662)

pablogsal webhook-mailer at python.org
Mon Dec 7 15:05:43 EST 2020


https://github.com/python/cpython/commit/b63a620014b67a6e63d10783149c41baaf59def8
commit: b63a620014b67a6e63d10783149c41baaf59def8
branch: master
author: Matěj Cepl <mcepl at cepl.eu>
committer: pablogsal <Pablogsal at gmail.com>
date: 2020-12-07T20:05:13Z
summary:

bpo-42579: Make workaround for various versions of Sphinx more robust (GH-23662)

The solution in gh#python/cpython#13236 is too strict because it
effectively requires the use of Sphinx >= 2.0. It is not too difficult to
make the same solution more robust so it works with all normal versions
of Sphinx.

files:
M Doc/tools/extensions/pyspecific.py

diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index 80fbd96d56fdc..28994399e25cf 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -394,7 +394,12 @@ def run(self):
                                    translatable=False)
             node.append(para)
         env = self.state.document.settings.env
-        env.get_domain('changeset').note_changeset(node)
+        # 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)
         return [node] + messages
 
 



More information about the Python-checkins mailing list