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 eric.smith
Recipients eric.smith, ned.deily, serhiy.storchaka, terry.reedy
Date 2017-06-16.16:49:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497631790.47.0.339057804659.issue30682@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-06-16 16:49:50eric.smithsetrecipients: + eric.smith, terry.reedy, ned.deily, serhiy.storchaka
2017-06-16 16:49:50eric.smithsetmessageid: <1497631790.47.0.339057804659.issue30682@psf.upfronthosting.co.za>
2017-06-16 16:49:50eric.smithlinkissue30682 messages
2017-06-16 16:49:50eric.smithcreate