Skip to content

Commit e79b686

Browse files
authored
fix debug.format case from more_debug.py example (#67)
* fix debug.format case from more_debug.py example * more cleanup
1 parent b30e0da commit e79b686

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

devtools/debug.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ def _statement_range(call_frame: 'FrameType', func_name: str) -> 'Tuple[int, int
310310
last_line = None
311311

312312
for instr in instructions: # pragma: no branch
313-
if instr.starts_line:
314-
if instr.opname in {'LOAD_GLOBAL', 'LOAD_NAME'} and instr.argval == func_name:
315-
first_line = instr.starts_line
316-
elif instr.opname == 'LOAD_GLOBAL' and instr.argval == 'debug':
317-
if next(instructions).argval == func_name:
318-
first_line = instr.starts_line
313+
if (
314+
instr.starts_line
315+
and instr.opname in {'LOAD_GLOBAL', 'LOAD_NAME'}
316+
and (instr.argval == func_name or (instr.argval == 'debug' and next(instructions).argval == func_name))
317+
):
318+
first_line = instr.starts_line
319319
if instr.offset == call_frame.f_lasti:
320320
break
321321

0 commit comments

Comments
 (0)