[issue46422] Why do we need `dis.Positions`?

2022-01-24 Thread Nikita Sobolev
Change by Nikita Sobolev : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue46422] Why do we need `dis.Positions`?

2022-01-24 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: New changeset 58f3d980989c7346ad792d464c1d749dcec6af63 by Nikita Sobolev in branch 'main': bpo-46422: use `dis.Positions` in `dis.Instruction` (GH-30716) https://github.com/python/cpython/commit/58f3d980989c7346ad792d464c1d749dcec6af63 --

[issue46422] Why do we need `dis.Positions`?

2022-01-19 Thread Nikita Sobolev
Change by Nikita Sobolev : -- keywords: +patch pull_requests: +28908 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30716 ___ Python tracker ___

[issue46422] Why do we need `dis.Positions`?

2022-01-19 Thread Nikita Sobolev
Nikita Sobolev added the comment: Ok then, I will send my option `2` proposal to fix this later today. -- ___ Python tracker ___

[issue46422] Why do we need `dis.Positions`?

2022-01-19 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: 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:

[issue46422] Why do we need `dis.Positions`?

2022-01-18 Thread Nikita Sobolev
New submission from Nikita Sobolev : While working on https://github.com/python/cpython/pull/30058 I've noticed that `Positions` namedtuple is kinda strange, source: https://github.com/python/cpython/blame/8c2fd09f365e082cfceb29afdf38953cdd670946/Lib/dis.py#L204-L213 Why? 1. It is not used.