mirror of
https://github.com/python/cpython.git
synced 2026-01-06 23:42:34 +00:00
fix parsing reST with code or code-block directives (closes #23063)
Patch by Marc Abramowitz.
This commit is contained in:
parent
29ad0111bd
commit
562b7cbff9
3 changed files with 38 additions and 4 deletions
|
|
@ -122,7 +122,7 @@ def _check_rst_data(self, data):
|
|||
"""Returns warnings when the provided data doesn't compile."""
|
||||
source_path = StringIO()
|
||||
parser = Parser()
|
||||
settings = frontend.OptionParser().get_default_values()
|
||||
settings = frontend.OptionParser(components=(Parser,)).get_default_values()
|
||||
settings.tab_width = 4
|
||||
settings.pep_references = None
|
||||
settings.rfc_references = None
|
||||
|
|
@ -138,8 +138,8 @@ def _check_rst_data(self, data):
|
|||
document.note_source(source_path, -1)
|
||||
try:
|
||||
parser.parse(data, document)
|
||||
except AttributeError:
|
||||
reporter.messages.append((-1, 'Could not finish the parsing.',
|
||||
'', {}))
|
||||
except AttributeError as e:
|
||||
reporter.messages.append(
|
||||
(-1, 'Could not finish the parsing: %s.' % e, '', {}))
|
||||
|
||||
return reporter.messages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue