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 serhiy.storchaka
Recipients nedbat, pablogsal, serhiy.storchaka, skip.montanaro
Date 2020-02-04.10:57:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580813835.12.0.580742074498.issue39537@roundup.psfhosted.org>
In-reply-to
Content
I planned to add a table for end line numbers, so every instruction will be associated with a range of lines.

For example, in

  x = {
    a,
    b
  }

the BUILD_SET instruction will be associated with lines 1-4. Currently it is associated only with line 1, and was associated with line 3 in 3.7.

In

  x = (
    a
    +
    b
  )

the BINARY_ADD instruction will be associated with lines 2-4. Currently it is associated with line 2, and was associated with line 4 in 3.7. The proposition about associating it with line 3 (containing the "+" operator) was rejected before.

In

  x = (
    a
    .
    b
  )

the LOAD_ATTR instruction will be associated with lines 2-4. Currently it is associated with line 2. The AST does not contain information about lines of "." and "b" tokens, but it contains information about the start and the end positions of "a.b".

This will help tools like coverage.py which are confused be executing the same line several times and may allow to generate more informative tracebacks.

As for END_ASYNC_FOR, it will be associated with the range of the "async for" statement.

Maybe we could use more efficient format for encoding start and end line numbers.
History
Date User Action Args
2020-02-04 10:57:15serhiy.storchakasetrecipients: + serhiy.storchaka, skip.montanaro, nedbat, pablogsal
2020-02-04 10:57:15serhiy.storchakasetmessageid: <1580813835.12.0.580742074498.issue39537@roundup.psfhosted.org>
2020-02-04 10:57:15serhiy.storchakalinkissue39537 messages
2020-02-04 10:57:14serhiy.storchakacreate