Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace the monkey patch to disable roman lists with an exception
We don't have a single clean method to disable roman lists across
docutils versions, but we can blow up the bulid cleanly...
  • Loading branch information
stefanor committed Oct 15, 2025
commit 220e71a1d8beff48d9100843a30078a8b930ecd4
9 changes: 7 additions & 2 deletions Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@
# Used in conf.py and updated here by python/release-tools/run_release.py
SOURCE_URI = 'https://github.com/python/cpython/tree/main/%s'

# monkey-patch reST parser to disable alphabetic and roman enumerated lists
# monkey-patch reST parser to detect any alphabetic and roman enumerated lists
# that need escaping. Sadly we don't get a location to point to.
from docutils.parsers.rst.states import Body
def disabled_converter(x):
raise Exception("Detected an alphabetic or Roman enumerated list. "
"It needs to be escaped.")

Body.enum.converters['loweralpha'] = \
Body.enum.converters['upperalpha'] = \
Body.enum.converters['lowerroman'] = \
Body.enum.converters['upperroman'] = lambda x: None
Body.enum.converters['upperroman'] = disabled_converter


class PyAwaitableMixin(object):
Expand Down