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 pablogsal
Recipients BTaskaya, gvanrossum, lukasz.langa, lys.nikolaou, pablogsal
Date 2020-10-07.18:39:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602095960.21.0.344241360429.issue41967@roundup.psfhosted.org>
In-reply-to
Content
> What's the issue exactly with multi-line annotations? 

The issue is that for grabbing the source, we are inspecting the tokenize buffer and using the information in the expr node of the annotation to know what we need to pick from it.

In multi-line annotations, the tokenize buffer does not contain the whole source, it just contains the last line.

To make it work, we would need to grab the individual tokens (because the tokenizer has all of them) and append them together to form the expression, but in this process we lose the non-significant whitespace.

---

Regarding loosing the whitespace for multi-line strings (or all string if we want to be consistent): the more I think about it the more I think is not that bad. This means that the string that the parser will place in the annotation field (and therefore the one that ends in __annotations__) will not have spaces, but the ast will be able to parse it without any problems. It will just look a bit crumbled, but that field is supposed to be used by tools, not humans, so I don't think is a huge problem.
History
Date User Action Args
2020-10-07 18:39:20pablogsalsetrecipients: + pablogsal, gvanrossum, lukasz.langa, lys.nikolaou, BTaskaya
2020-10-07 18:39:20pablogsalsetmessageid: <1602095960.21.0.344241360429.issue41967@roundup.psfhosted.org>
2020-10-07 18:39:20pablogsallinkissue41967 messages
2020-10-07 18:39:20pablogsalcreate