Python: CG trace: Remove Python 3.8 only f"{var=}" usage

This commit is contained in:
Rasmus Wriedt Larsen
2020-07-23 13:40:43 +02:00
parent bb4b8dceaa
commit da518ed0d5
2 changed files with 5 additions and 3 deletions

View File

@@ -155,7 +155,9 @@ def expr_that_added_elem_to_stack(
immediately. (since correctly process the bytecode when faced with jumps is not as immediately. (since correctly process the bytecode when faced with jumps is not as
straight forward). straight forward).
""" """
LOGGER.debug(f"find_inst_that_added_elem_to_stack {start_index=} {stack_pos=}") LOGGER.debug(
f"find_inst_that_added_elem_to_stack start_index={start_index} stack_pos={stack_pos}"
)
assert stack_pos >= 0 assert stack_pos >= 0
for inst in reversed(instructions[: start_index + 1]): for inst in reversed(instructions[: start_index + 1]):
# Return immediately if faced with a jump # Return immediately if faced with a jump
@@ -179,7 +181,7 @@ def expr_that_added_elem_to_stack(
def expr_from_instruction(instructions: List[Instruction], index: int) -> BytecodeExpr: def expr_from_instruction(instructions: List[Instruction], index: int) -> BytecodeExpr:
inst = instructions[index] inst = instructions[index]
LOGGER.debug(f"expr_from_instruction: {inst} {index=}") LOGGER.debug(f"expr_from_instruction: {inst} index={index}")
if inst.opname in ["LOAD_GLOBAL", "LOAD_FAST", "LOAD_NAME", "LOAD_DEREF"]: if inst.opname in ["LOAD_GLOBAL", "LOAD_FAST", "LOAD_NAME", "LOAD_DEREF"]:
return BytecodeVariableName(inst.argval) return BytecodeVariableName(inst.argval)

View File

@@ -192,7 +192,7 @@ class CallGraphTracer:
if event not in ["call", "c_call"]: if event not in ["call", "c_call"]:
return return
LOGGER.debug(f"profilefunc {event=}") LOGGER.debug(f"profilefunc event={event}")
if event == "call": if event == "call":
# in call, the `frame` argument is new the frame for entering the callee # in call, the `frame` argument is new the frame for entering the callee
assert frame.f_back is not None assert frame.f_back is not None