[issue28002] Some f-strings do not round trip through Tools/parser/test_unparse.py

Logan Jones report at bugs.python.org
Mon May 6 15:56:22 EDT 2019


Logan Jones <loganasherjones at gmail.com> added the comment:

After speaking with Lukasz about this, it seems like the unparser is using the normal unicode repr to determine what should be returned. The default unicode repr will escape quotes if necessary. This is not allowed for f-strings and is the root cause of the problem. 
 
One way to solve this is to add a flag to the unicode_repr function to determine whether or not we need to allow triple quotes in the output of the repr. By default this will be false and will use backslashes, but the ast_unparse will use true for this.

----------
nosy: +loganasherjones

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


More information about the Python-bugs-list mailing list