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, benjamin.peterson, eric.smith, kayhayen, levkivskyi, lukasz.langa, pablogsal
Date 2019-12-27.20:05:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577477111.27.0.841301137307.issue35143@roundup.psfhosted.org>
In-reply-to
Content
I don't think this is a bug. Technically the 'from __future__ import annotations' is a compiler option, not an AST one. Also, the flag says that "annotations become strings at runtime" and at the point, we have an AST is not still runtime. The CO_FUTURE_ANNOTATIONS only takes place in the compiler that reverses the AST object into a string. If we make the AST aware of CO_FUTURE_ANNOTATIONS, then what the compiler will see in the presence of  'from __future__ import annotations' would be different if you compile a module than if you parse it using ast.parse() and then compile the result (in the second case the compiler will see strings in the annotations, not AST nodes while in the first case it will see nodes). Additionally, doing this will limit tools that want to analyze the contents of those annotations before they get turned into strings (like type checker, linters...etc).
History
Date User Action Args
2019-12-27 20:05:11pablogsalsetrecipients: + pablogsal, eric.smith, benjamin.peterson, lukasz.langa, kayhayen, levkivskyi, BTaskaya
2019-12-27 20:05:11pablogsalsetmessageid: <1577477111.27.0.841301137307.issue35143@roundup.psfhosted.org>
2019-12-27 20:05:11pablogsallinkissue35143 messages
2019-12-27 20:05:10pablogsalcreate