mirror of https://github.com/python/cpython.git
main(): Slightly more informative error message when TokenError
occurs. Also, continue processing.
This commit is contained in:
parent
68d486c8f4
commit
75ee8f54fa
|
@ -464,7 +464,11 @@ class Options:
|
|||
closep = 1
|
||||
try:
|
||||
eater.set_filename(filename)
|
||||
tokenize.tokenize(fp.readline, eater)
|
||||
try:
|
||||
tokenize.tokenize(fp.readline, eater)
|
||||
except tokenize.TokenError, e:
|
||||
sys.stderr.write('%s: %s, line %d, column %d\n' %
|
||||
(e[0], filename, e[1][0], e[1][1]))
|
||||
finally:
|
||||
if closep:
|
||||
fp.close()
|
||||
|
|
Loading…
Reference in New Issue