[issue43798] Add position metadata to alias AST type

Pablo Galindo Salgado report at bugs.python.org
Sun Apr 11 19:01:03 EDT 2021


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

> FYI, probably unavoidable, but this appears to have broken pytest https://github.com/pytest-dev/pytest/issues/8539

What's the problem? alias objects *have* lineno argument:

>>> print(ast.dump(ast.parse("from x import y"), include_attributes=True, indent=4))
Module(
    body=[
        ImportFrom(
            module='x',
            names=[
                alias(
                    name='y',
                    lineno=1,
                    col_offset=14,
                    end_lineno=1,
                    end_col_offset=15)],
            level=0,
            lineno=1,
            col_offset=0,
            end_lineno=1,
            end_col_offset=15)],
    type_ignores=[])

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43798>
_______________________________________


More information about the Python-bugs-list mailing list