mcpyrate
mcpyrate copied to clipboard
Support new source location fields in Python 3.8+
Python 3.8 added the end_lineno and end_col_offset fields to AST nodes that have lineno and col_offset.
Specs in the official documentation.
We should probably worry about these anywhere we handle source location info.
Same in unpythonic; tracked in https://github.com/Technologicat/unpythonic/issues/83
As of v3.6.2, we fill in the end_lineno and end_col_offset info in the global postprocess pass (copying it from reference nodes), but that's literally the only thing we do with this information at this point.
This was needed to get Python 3.11+ support working, because as of Python 3.11, the compiler now includes an AST validator (which is a good thing!) that requires e.g. that end_lineno >= lineno.