Commit a9ffc453 authored by Michael Arntzenius's avatar Michael Arntzenius

handle python errmsg changes in {exec,name_forcing}_syntax_error.py

parent ca756882
s = """ s = """
def f(): def f():
a = 1 a = 1
...@@ -11,7 +10,8 @@ f() ...@@ -11,7 +10,8 @@ f()
try: try:
exec s exec s
except Exception as e: except Exception as e:
print repr(e) # avoid microrevision changes to Python error messages
print repr(e).replace("because ", "")
s = """ s = """
def f(): def f():
...@@ -27,4 +27,5 @@ f() ...@@ -27,4 +27,5 @@ f()
try: try:
exec s exec s
except Exception as e: except Exception as e:
print repr(e) # avoid microrevision changes to Python error messages
print repr(e).replace("because ", "")
...@@ -208,6 +208,6 @@ for case in cases: ...@@ -208,6 +208,6 @@ for case in cases:
try: try:
exec case exec case
except SyntaxError as se: except SyntaxError as se:
print se.message print se.message.replace("because ", "")
# TODO uncomment this # TODO uncomment this
# traceback.print_exc() # traceback.print_exc()
...@@ -125,6 +125,8 @@ def canonicalize_stderr(stderr): ...@@ -125,6 +125,8 @@ def canonicalize_stderr(stderr):
("AttributeError: '(\w+)' object attribute '(\w+)' is read-only", "AttributeError: \\2"), ("AttributeError: '(\w+)' object attribute '(\w+)' is read-only", "AttributeError: \\2"),
(r"TypeError: object.__new__\(\) takes no parameters", "TypeError: object() takes no parameters"), (r"TypeError: object.__new__\(\) takes no parameters", "TypeError: object() takes no parameters"),
("IndexError: list assignment index out of range", "IndexError: list index out of range"), ("IndexError: list assignment index out of range", "IndexError: list index out of range"),
(r"unqualified exec is not allowed in function '(\w+)' it (.*)",
r"unqualified exec is not allowed in function '\1' because it \2"),
] ]
for pattern, subst_with in substitutions: for pattern, subst_with in substitutions:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment