summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-01-16 05:53:54 (GMT)
committerGeorg Brandl <georg@python.org>2014-01-16 05:53:54 (GMT)
commitaabebde358a9a9630e7afb03b4bc4bd217774ef3 (patch)
treea71bd2dd0dd9f40bd28a68ce57470356d3cf0cf5 /Tools
parentbac7793b5b9145b350d7e7bad1c3af99a10103b7 (diff)
downloadcpython-aabebde358a9a9630e7afb03b4bc4bd217774ef3.zip
cpython-aabebde358a9a9630e7afb03b4bc4bd217774ef3.tar.gz
cpython-aabebde358a9a9630e7afb03b4bc4bd217774ef3.tar.bz2
Closes #20235: Report file and line on unexpected exceptions in Argument Clinic.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/clinic/clinic.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index ed59f05..23e0b93 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -21,6 +21,7 @@ import shlex
import sys
import tempfile
import textwrap
+import traceback
# TODO:
#
@@ -1082,7 +1083,11 @@ class Clinic:
assert dsl_name in parsers, "No parser to handle {!r} block.".format(dsl_name)
self.parsers[dsl_name] = parsers[dsl_name](self)
parser = self.parsers[dsl_name]
- parser.parse(block)
+ try:
+ parser.parse(block)
+ except Exception:
+ fail('Exception raised during parsing:\n' +
+ traceback.format_exc().rstrip())
printer.print_block(block)
return printer.f.getvalue()