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 BTaskaya
Recipients BTaskaya, pablogsal, sobolevn
Date 2022-01-19.08:52:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642582375.66.0.248766378357.issue46422@roundup.psfhosted.org>
In-reply-to
Content
The initial aim of the dis.Positions was to provide an interface like AST nodes. So you could do

for instr in dis.Bytecode(source):
    print("located in: ", instr.positions.lineno)

instead of

for instr in dis.Bytecode(source):
    if instr.positions:
        lineno = instr.positions[0]
    else:
        lineno = None
    print("located in: ", lineno)

I think this is a bug that we are not currently using it, I'd say we should use it properly and go with option 2.
History
Date User Action Args
2022-01-19 08:52:55BTaskayasetrecipients: + BTaskaya, pablogsal, sobolevn
2022-01-19 08:52:55BTaskayasetmessageid: <1642582375.66.0.248766378357.issue46422@roundup.psfhosted.org>
2022-01-19 08:52:55BTaskayalinkissue46422 messages
2022-01-19 08:52:55BTaskayacreate