mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix SF Bug 564931: compile() traceback must include filename.
This commit is contained in:
parent
4254cbd29c
commit
6b17abf6c0
5 changed files with 55 additions and 4 deletions
|
@ -22,6 +22,15 @@ try:
|
|||
except SyntaxError:
|
||||
pass
|
||||
|
||||
if verbose:
|
||||
print "compiling string with syntax error"
|
||||
|
||||
try:
|
||||
compile("1+*3", "filename", "exec")
|
||||
except SyntaxError, detail:
|
||||
if not detail.filename == "filename":
|
||||
raise TestFailed, "expected 'filename', got %r" % detail.filename
|
||||
|
||||
try:
|
||||
exec 'def f(a = 0, a = 1): pass'
|
||||
raise TestFailed, "duplicate keyword arguments"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue