summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-10-03 03:59:46 (GMT)
committerGitHub <noreply@github.com>2022-10-03 03:59:46 (GMT)
commita1711ef030d0b637da75ff5a870ac1a3fd959c04 (patch)
treeef398719640d79c3f3de7e98fa6897305e794936 /Doc
parentc2d3f73da780ce4d568f541fb7f55917a814d65c (diff)
downloadcpython-a1711ef030d0b637da75ff5a870ac1a3fd959c04.zip
cpython-a1711ef030d0b637da75ff5a870ac1a3fd959c04.tar.gz
cpython-a1711ef030d0b637da75ff5a870ac1a3fd959c04.tar.bz2
gh-97740: Fix bang in Sphinx C domain ref target syntax (GH-97741)
* gh-97740: Fix bang in Sphinx C domain ref target syntax Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> * Add NEWS entry for C domain bang fix Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> (cherry picked from commit 9148c0d893c7807331fd7be0997261e289074bc5) Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/conf.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/conf.py b/Doc/conf.py
index 8fdff79..aff26f9 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -244,3 +244,18 @@ c_allow_pre_v3 = True
# 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
+
+# Fix '!' not working with C domain when pre_v3 is enabled
+import sphinx
+
+if sphinx.version_info[:2] < (5, 3):
+ from sphinx.domains.c import CXRefRole
+
+ original_run = CXRefRole.run
+
+ def new_run(self):
+ if self.disabled:
+ return super(CXRefRole, self).run()
+ return original_run(self)
+
+ CXRefRole.run = new_run