classification
Title: py_compile.compile SyntaxError output
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 2.7, Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, nheron
Priority: normal Keywords: patch

Created on 2010-02-02 22:50 by nheron, last changed 2010-04-09 03:15 by ajaksu2.

Files
File name Uploaded Description Edit
py_compile_patch.diff nheron, 2010-02-02 22:50 patch review
Messages (2)
msg98766 - (view) Author: Nigel Heron (nheron) Date: 2010-02-02 22:50
when a syntax error is generated in py_compile.compile(), the wrong arguments are passed to the new PyCompileError exception which in turn passes the wrong args to traceback.format_exception_only() producing the wrong output.

this was fixed in the py3k branch (Revision 56901) but is still broken in 2.6 and 2.7
the attached patch has the same fix but applied to the trunk.

here's a simple test case..

f = open('broken.py','w')
f.write("1 = a  #<-- obvious syntax err\n")
f.close()
import py_compile
py_compile.compile('broken.py')
msg102674 - (view) Author: Daniel Diniz (ajaksu2) Date: 2010-04-09 03:15
Change went into py3k without tests, do we want them? If so, please update Stage to "test needed".
History
Date User Action Args
2010-04-09 03:15:53ajaksu2setpriority: normal

nosy: + ajaksu2
messages: + msg102674

stage: patch review
2010-02-02 22:50:03nheroncreate