Message399593
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. |
|
Date |
User |
Action |
Args |
2021-08-14 14:42:22 | BTaskaya | set | recipients:
+ BTaskaya, brett.cannon, benjamin.peterson, Mark.Shannon, yselivanov, pablogsal, xiaket |
2021-08-14 14:42:22 | BTaskaya | set | messageid: <1628952142.63.0.343772088419.issue44896@roundup.psfhosted.org> |
2021-08-14 14:42:22 | BTaskaya | link | issue44896 messages |
2021-08-14 14:42:22 | BTaskaya | create | |
|