[issue41967] Handle annotations in the parser to avoid the need for roundtrip

Pablo Galindo Salgado report at bugs.python.org
Wed Oct 7 20:13:05 EDT 2020


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

> I remember the char* pointer where the expression starts, then I parse the expression into an AST, then I note the char* pointer where the expression ended. The text between those is what's output before the equal sign []. This is how I preserve all of the whitespace inside the expression.

Unless I am missing something, the problem is that the tokenizer has thrown away the extra newlines so we cannot keep the pointer where the expression starts. Also, I am not sure if this is the same scenario because f-strings cannot contain newlines in the expression brackets, can't they?

----------

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


More information about the Python-bugs-list mailing list