New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why do we need dis.Positions
?
#90580
Comments
While working on #30058 I've noticed that Why?
co_positions = co_positions or iter(())
try:
positions = next(co_positions)
except StopIteration:
positions = None
Instruction(positions=positions) So, it is at best is What to do with it?
In my opinion, it is not required, because we already have I would like to work on it after a final decision is made :) |
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. |
Ok then, I will send my option |
dis.Positions
indis.Instruction
#30716Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: