SyntaxError exception 1.5.1 vs 1.5.2

chris at journyx.com chris at journyx.com
Fri Aug 27 19:47:15 EDT 1999


i've noticed differences between 1.5.1 and 1.5.2 wrt: handling a
SyntaxError exception. Which behavior is correct?

Here is the scenario:

bad_syntax.py:
hello"

build_py.py:
import sys

try:
	py_compile.compile('bad_syntax.py')
	print "after compile"
except:
	print "compile error"

now the output:

python1.5.1:
compile error

python1.5.2:
File "bad_syntax.py", line 1
    hello"
         ^
SyntaxError: invalid token
after compile


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list