Skip to content

Commit edda9dd

Browse files
gh-97740: Fix bang in Sphinx C domain ref target syntax
Co-authored-by: Adam Turner <[email protected]>
1 parent cac2e8a commit edda9dd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Doc/conf.py

+15
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,18 @@
249249
# bpo-40204: Disable warnings on Sphinx 2 syntax of the C domain since the
250250
# documentation is built with -W (warnings treated as errors).
251251
c_warn_on_allowed_pre_v3 = False
252+
253+
# Fix '!' not working with C domain when pre_v3 is enabled
254+
import sphinx
255+
256+
if sphinx.version_info[:2] < (5, 3):
257+
from sphinx.domains.c import CXRefRole
258+
259+
original_run = CXRefRole.run
260+
261+
def new_run(self):
262+
if self.disabled:
263+
return super(CXRefRole, self).run()
264+
return original_run(self)
265+
266+
CXRefRole.run = new_run

0 commit comments

Comments
 (0)