Eric V. Smith added the comment:
Terry:
The eval is important. The bug was in evaluating an f-string that consisted of
two bytes: a backslash followed by a newline.
And just as:
eval("'\\\n'") == '' # len == 0
so should
eval("f'\\\n'") == '' # len == 0
It's the second one that was throwing the assertion. The parser was seeing
these bytes:
f 0x66
' 0x27
\ 0x5c
nl 0xa
' 0x27
and behaving badly (to say the least) by asserting.
Without the eval, I can't think of a way to have a string consisting of those
two bytes, but I assume someone who's trickier than I can come up with a way.
----------
resolution: -> fixed
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30682>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com