ast.fix_missing_locations()

ast.fix_missing_locations(node)

When you compile a node tree with compile(), the compiler expects lineno and col_offset attributes for every node that supports them. This is rather tedious to fill in for generated nodes, so this helper adds these attributes recursively where not already set, by setting them to the values of the parent node. It works recursively starting at node.

doc_python
2016-10-07 17:26:19
Comments
Leave a Comment

Please login to continue.