Matej Cepl
2db1a650e2
ReDos via excessive backtracking while parsing header values (bsc#1230227, CVE-2024-6232). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python?expand=0&rev=425
29 lines
1.2 KiB
Diff
29 lines
1.2 KiB
Diff
---
|
|
Doc/tools/extensions/pyspecific.py | 11 +++++++----
|
|
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
|
--- a/Doc/tools/extensions/pyspecific.py
|
|
+++ b/Doc/tools/extensions/pyspecific.py
|
|
@@ -31,14 +31,17 @@ Body.enum.converters['loweralpha'] = \
|
|
# doctest docs themselves
|
|
orig_visit_literal_block = HTMLTranslator.visit_literal_block
|
|
def new_visit_literal_block(self, node):
|
|
+ old_trim_doctest_flags = None
|
|
meta = self.builder.env.metadata[self.builder.current_docname]
|
|
- old_trim_doctest_flags = self.highlighter.trim_doctest_flags
|
|
- if 'keepdoctest' in meta:
|
|
- self.highlighter.trim_doctest_flags = False
|
|
+ if hasattr(self.highlighter, 'trim_doctest_flags'):
|
|
+ old_trim_doctest_flags = self.highlighter.trim_doctest_flags
|
|
+ if 'keepdoctest' in meta:
|
|
+ self.highlighter.trim_doctest_flags = False
|
|
try:
|
|
orig_visit_literal_block(self, node)
|
|
finally:
|
|
- self.highlighter.trim_doctest_flags = old_trim_doctest_flags
|
|
+ if old_trim_doctest_flags is not None:
|
|
+ self.highlighter.trim_doctest_flags = old_trim_doctest_flags
|
|
|
|
HTMLTranslator.visit_literal_block = new_visit_literal_block
|
|
|