New submission from Steven Myint:

Since #29463, it is no longer obvious how to get the line number of a docstring 
in the AST:

    import ast

    x = ast.parse('''\
    def foo():
        """This is a docstring."""

    # In Python 3.6, the docstring and line number would be:

    # In Python 3.7, I don't know what the equivalent would be.
    # Line number?

We use this feature in pyflakes (

components: Interpreter Core
messages: 294654
nosy: myint
priority: normal
severity: normal
status: open
title: Line number of docstring in AST
versions: Python 3.7

Python tracker <>
Python-bugs-list mailing list

Reply via email to