Issue 7842: py_compile.compile SyntaxError output (original) (raw)

Issue7842

Created on 2010-02-02 22:50 by nheron, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
py_compile_patch.diff nheron,2010-02-02 22:50 patch review
Messages (4)
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) * (Python triager) Date: 2010-04-09 03:15
Change went into py3k without tests, do we want them? If so, please update Stage to "test needed".
msg182458 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-20 01:01
New changeset c7f04c09dc56 by R David Murray in branch '2.7': #7842: backport fix for py_compile.compile syntax error message handling. http://hg.python.org/cpython/rev/c7f04c09dc56
msg182460 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-02-20 01:03
Better late than never. Be nice if someone would contribute a test, but I'm not going let that hold things up for such a simple patch that is already in default with no test.
History
Date User Action Args
2022-04-11 14:56:57 admin set github: 52090
2013-02-20 01:03:32 r.david.murray set status: open -> closednosy: + r.david.murraymessages: + resolution: fixedstage: patch review -> resolved
2013-02-20 01:01:15 python-dev set nosy: + python-devmessages: +
2010-04-09 03:15:53 ajaksu2 set priority: normalnosy: + ajaksu2messages: + stage: patch review
2010-02-02 22:50:03 nheron create