Batuhan Taskaya <isidenti...@gmail.com> added the comment:
> Which for some reason has made the `annotation` a `str` rather than `Name`. > So I think it's my bug then? Yes, from what I can see it is a bug in your code. > body=[AnnAssign(annotation='int', The 'annotation' field in 'AnnAssign' nodes are designated as expressions. So you need to either wrap that into an ast.Name() node, or an ast.Constant() node (if you want to stringify it with quotes in the generated code). For more information about fields you can read this; https://github.com/python/cpython/blob/ac811f9b5a68ce8756911ef2c8be83b46696018f/Parser/Python.asdl#L29 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44825> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com