classification
Title: future imports change the reporting of syntaxerrors
Type: Stage: resolved
Components: Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Ronny.Pfannschmidt, benjamin.peterson, python-dev
Priority: normal Keywords:

Created on 2011-05-30 14:54 by Ronny.Pfannschmidt, last changed 2011-05-30 16:15 by python-dev. This issue is now closed.

Messages (3)
msg137285 - (view) Author: Ronny Pfannschmidt (Ronny.Pfannschmidt) Date: 2011-05-30 14:54
>>> compile('def foo(', '', 'exec')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 1
    def foo(
          ^
SyntaxError: unexpected EOF while parsing

vs

>>> compile('from __future__ import print_function\ndef foo(', '', 'exec')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 2
    def foo(
          ^
SyntaxError: invalid syntax
msg137294 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-05-30 15:27
Actually anything before the last statement will cause this

>>> compile("\ndef foo(", '', 'exec')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 2
    def foo(
           ^
SyntaxError: invalid syntax
msg137300 - (view) Author: Roundup Robot (python-dev) Date: 2011-05-30 16:15
New changeset fefca6548732 by Benjamin Peterson in branch 'default':
don't restrict unexpected EOF errors to the first line (closes #12216)
http://hg.python.org/cpython/rev/fefca6548732
History
Date User Action Args
2011-05-30 16:15:12python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg137300

resolution: fixed
stage: resolved
2011-05-30 15:27:12benjamin.petersonsetmessages: + msg137294
2011-05-30 15:02:04hayposetnosy: + benjamin.peterson
2011-05-30 14:54:57Ronny.Pfannschmidtcreate