diff options
author | gaogaotiantian <gaogaotiantian@hotmail.com> | 2023-03-27 22:22:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 22:22:06 (GMT) |
commit | 34eb6f727632d9a1a6998f90c9421e420c785643 (patch) | |
tree | 7baf8c3479fd74ec07156577798272f4475b8bd1 /Lib/dis.py | |
parent | 36067532467ec58c87ac9c140e555e1866431981 (diff) | |
download | cpython-34eb6f727632d9a1a6998f90c9421e420c785643.zip cpython-34eb6f727632d9a1a6998f90c9421e420c785643.tar.gz cpython-34eb6f727632d9a1a6998f90c9421e420c785643.tar.bz2 |
gh-103046: Display current line correctly for `dis.disco()` with CACHE entries (#103047)
Diffstat (limited to 'Lib/dis.py')
-rw-r--r-- | Lib/dis.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -581,7 +581,12 @@ def _disassemble_bytes(code, lasti=-1, varname_from_oparg=None, instr.offset > 0) if new_source_line: print(file=file) - is_current_instr = instr.offset == lasti + if show_caches: + is_current_instr = instr.offset == lasti + else: + # Each CACHE takes 2 bytes + is_current_instr = instr.offset <= lasti \ + <= instr.offset + 2 * _inline_cache_entries[_deoptop(instr.opcode)] print(instr._disassemble(lineno_width, is_current_instr, offset_width), file=file) if exception_entries: |