[issue40246] Different error messages for same error - invalid string prefixes

STINNER Victor report at bugs.python.org
Thu May 14 22:54:19 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

The following change broke test_fstring when using the old parser. I reopen the issue.

commit 846d8b28ab9bb6197ee81372820311c0abe509c0 (refs/bisect/bad)
Author: Lysandros Nikolaou <lisandrosnik at gmail.com>
Date:   Mon May 4 14:32:18 2020 +0300

    bpo-40246: Revert reporting of invalid string prefixes (GH-19888)
    
    Due to backwards compatibility concerns regarding keywords immediately followed by a string without whitespace between them (like in `bg="#d00" if clear else"#fca"`) will fail to parse,
    commit 41d5b94af44e34ac05d4cd57460ed104ccf96628 has to be reverted.


$ ./python -X oldparser -m test -v test_fstring 
(...)
======================================================================
FAIL: test_invalid_string_prefixes (test.test_fstring.TestCase) (str='BF""')
----------------------------------------------------------------------
  File "<string>", line 1
    BF""
      ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/test_fstring.py", line 29, in assertAllRaise
    eval(str)
AssertionError: "unexpected EOF while parsing" does not match "invalid syntax (<string>, line 1)"
(...)

----------
resolution: wont fix -> 
status: closed -> open

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40246>
_______________________________________


More information about the Python-bugs-list mailing list