Łukasz Langa <[email protected]> added the comment:
I think this is a bug, actually. It's going to be an incompatibility in
`ast.parse` so we'll probably want to only enable it in Python 3.8.
This should have stringified annotations:
>>> p = ast.parse("""
... from __future__ import annotations
... a: 1
... """)
>>> p.body[1].annotation # ACTUAL
<_ast.Num object at 0x1048cf470>
>>> p.body[1].annotation # EXPECTED
<_ast.Str object at 0x1048cf6a0>
----------
assignee: -> lukasz.langa
stage: -> needs patch
title: Annotations future requires unparse, but not accessible from Python ->
`from __future__ import annotations` has no effect inside `ast.parse`
type: enhancement -> behavior
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35143>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com