mcpyrate icon indicating copy to clipboard operation
mcpyrate copied to clipboard

Support new source location fields in Python 3.8+

Open Technologicat opened this issue 3 years ago • 2 comments
trafficstars

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.

Technologicat avatar Jan 27 '22 11:01 Technologicat

Same in unpythonic; tracked in https://github.com/Technologicat/unpythonic/issues/83

Technologicat avatar Jan 27 '22 11:01 Technologicat

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.

Technologicat avatar Sep 27 '24 13:09 Technologicat