This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author myint
Recipients myint
Date 2017-05-28.18:44:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1495997066.31.0.794903121268.issue30497@psf.upfronthosting.co.za>
In-reply-to
Content
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:
    print(x.body[0].body[0].value.s)
    print(x.body[0].body[0].value.lineno)

    # In Python 3.7, I don't know what the equivalent would be.
    print(x.body[0].docstring)
    # Line number?

We use this feature in pyflakes (https://github.com/PyCQA/pyflakes/issues/271).
History
Date User Action Args
2017-05-28 18:44:26myintsetrecipients: + myint
2017-05-28 18:44:26myintsetmessageid: <1495997066.31.0.794903121268.issue30497@psf.upfronthosting.co.za>
2017-05-28 18:44:26myintlinkissue30497 messages
2017-05-28 18:44:26myintcreate