This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cito
Recipients chris.259263, cito, eric.smith
Date 2018-01-10.16:33:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1515602023.88.0.467229070634.issue31140@psf.upfronthosting.co.za>
In-reply-to
Content
I can confirm that the problem still exists in Python 3.6.4 and 3.7.0a4.

Here is another way to demonstrate it:

Create the following file test.py:

    # test
    hello = f"{world)}"

Note that there is a syntax error in the f-string in line 2 which has a closing parentheses, but no opening one.

Import this from Python 3.6.4 or 3.7.0a4:

>>> import test
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<fstring>", line 1
    (world))
           ^
SyntaxError: unexpected EOF while parsing

The problem here is that the error message does not contain the name of the erroneous file (test.py), points to a wrong line (line 1 instead of line 2), and also shows parentheses instead of braces around the word "world", which are not there in the original code. This can make it hard to locate such errors.

Note that when there are other kinds of errors in the f-string, or other kinds of "unexpected EOF" in the imported file, the errorenous file is usually reported correctly in the error message. Only certain kinds of syntax errors in f-strings seem to be problematic.
History
Date User Action Args
2018-01-10 16:33:44citosetrecipients: + cito, eric.smith, chris.259263
2018-01-10 16:33:43citosetmessageid: <1515602023.88.0.467229070634.issue31140@psf.upfronthosting.co.za>
2018-01-10 16:33:43citolinkissue31140 messages
2018-01-10 16:33:43citocreate