Batuhan Taskaya <isidenti...@gmail.com> added the comment:
I don't think this is really an issue considering some other functionalities that consumes AST code (e.g `compile`) will expect it to be annotated with location metadata. This is why the `ast` module already comes bundled with a utility function called `fix_missing_locations` which in your example would work; > print(ast.unparse(bad)) > print(ast.unparse(ast.fix_missing_locations(bad))) Though I recall seeing this error once before, and since there also some counter examples (e.g ast.increment_lineno) that assume an AST node might lack of these attributes even though the nodes declare them makes it worth to fix. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44896> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com