main icon indicating copy to clipboard operation
main copied to clipboard

exec("something with a syntax error") produces different error messages under CPython 2.7

Open ironpythonbot opened this issue 10 years ago • 0 comments

Besides the small repro below, please note that CPython 2.7 no longer exactly preserves whitespace as it was in the string passed to exec. E.g., "\r\n" is now consistently turned into "\n".

D:\rft\vsl\dlr\Languages\IronPython\Tests>26 -c "exec('print 1\ndef f()\rprint 3')"
Traceback (most recent call last):
File "", line 1, in
File "", line 2
print 3 f()

       ^

SyntaxError: invalid syntax

D:\rft\vsl\dlr\Languages\IronPython\Tests>27 -c "exec('print 1\ndef f()\rprint 3')"
Traceback (most recent call last):
File "", line 1, in
File "", line 2

def f()
      ^

SyntaxError: invalid syntax

Work Item Details

Original CodePlex Issue: Issue 28380 Status: Proposed Reason Closed: Unassigned Assigned to: Unassigned Reported on: Aug 2, 2010 at 6:12 PM Reported by: dfugate Updated on: Feb 22, 2013 at 2:10 AM Updated by: jdhardy Test: test_syntax.py (test_syntaxerror_text)

ironpythonbot avatar Dec 09 '14 17:12 ironpythonbot