Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cosmetic adjustements
  • Loading branch information
picnixz committed Aug 21, 2024
commit 9dc5ed2be26365ae8bfb48fd8e409c6a0832748b
7 changes: 5 additions & 2 deletions Lib/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,11 @@ def print_instruction_line(self, instr, mark_as_current):
if self.show_positions:
# reporting positions instead of just line numbers
if instr_positions := instr.positions:
ps = tuple('?' if p is None else p for p in instr_positions)
positions_str = f"{ps[0]}:{ps[2]}-{ps[1]}:{ps[3]}"
if all(p is None for p in instr_positions):
positions_str = _NO_LINENO
else:
ps = tuple('?' if p is None else p for p in instr_positions)
positions_str = f"{ps[0]}:{ps[2]}-{ps[1]}:{ps[3]}"
fields.append(f'{positions_str:{lineno_width}}')
else:
fields.append(' ' * lineno_width)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ def f():
expect = '\n'.join([
'43:?-43:? RESUME 0',
'',
'?:?-?:? NOP',
' -- NOP',
'',
'45:0-48:4 RETURN_CONST 0 (None)',
'',
Expand Down