https://github.com/python/cpython/commit/f9d2cd02456f1b867d8075d17e9ba7dbdb3ad3bd
commit: f9d2cd02456f1b867d8075d17e9ba7dbdb3ad3bd
branch: 3.11
author: Stan Ulbrych <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-10-24T21:08:50-07:00
summary:

[3.11] Add Sphinx markup for CVEs in Changelog entries (GH-159415) (#159938)

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

diff --git a/Doc/conf.py b/Doc/conf.py
index 7554b64e3cc4102..2ce143240e31d8d 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -24,6 +24,7 @@
     'pyspecific',
     'sphinx.ext.coverage',
     'sphinx.ext.doctest',
+    'sphinx.ext.extlinks',
 ]
 
 # Skip if downstream redistributors haven't installed it
@@ -500,6 +501,11 @@
 refcount_file = 'data/refcounts.dat'
 stable_abi_file = 'data/stable_abi.dat'
 
+# sphinx.ext.extlinks config
+extlinks = {
+    'cve': ('https://www.cve.org/CVERecord?id=CVE-%s', 'CVE-%s'),
+}
+
 # sphinxext-opengraph config
 ogp_site_url = 'https://docs.python.org/3/'
 ogp_site_name = 'Python documentation'
diff --git a/Doc/tools/extensions/pyspecific.py 
b/Doc/tools/extensions/pyspecific.py
index c71ad641d7c07b4..80982d566513b18 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -496,6 +496,7 @@ def run(self):
 
 issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)', re.I)
 gh_issue_re = re.compile('(?:gh-issue-|gh-)([0-9]+)', re.I)
+cve_re = re.compile('CVE-([0-9]{4}-[0-9]{4,})', re.I)
 whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$")
 
 
@@ -525,6 +526,7 @@ def run(self):
         content = issue_re.sub(r':issue:`\1`', content)
         # Fallback handling for the GitHub issue
         content = gh_issue_re.sub(r':gh:`\1`', content)
+        content = cve_re.sub(r':cve:`\1`', content)
         content = whatsnew_re.sub(r'\1', content)
         # remove first 3 lines as they are the main heading
         lines = ['.. default-role:: obj', ''] + content.splitlines()[3:]

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to