@@ -116,8 +116,9 @@ def get_option(key: str) -> Any:
116116 self .stop_on_finish = False
117117
118118 self .last_lineno = None
119+ self .last_offset = None
119120 self .last_filename = None
120- self .different_line = None
121+ self .different_line = True
121122
122123 # The reason we have stopped, e.g. 'breakpoint hit', 'next',
123124 # 'finish', 'step', or 'exception'.
@@ -344,7 +345,7 @@ def matches_condition(self, frame):
344345 return val
345346
346347 def is_stop_here (self , frame , event ):
347- """Does the magic to determine if we stop here and run a
348+ """Do the magic to determine if we stop here and run a
348349 command processor or not. If so, return True and set
349350 self.stop_reason; if not, return False.
350351
@@ -362,13 +363,16 @@ def is_stop_here(self, frame, event):
362363 # Do we want a different line and if so,
363364 # do we have one?
364365 lineno = frame .f_lineno
366+ offset = frame .f_lasti
365367 filename = frame .f_code .co_filename
366- if self .different_line and event == "line" :
368+ if self .different_line and event in ( "line" , "opcode" ) :
367369 if self .last_lineno == lineno and self .last_filename == filename :
368- # print("is_stop_here(): not different")
369- return False
370+ if event != "opcode" or self .last_offset == offset :
371+ # print("is_stop_here(): not different")
372+ return False
370373 pass
371374 self .last_lineno = lineno
375+ self .last_offset = offset
372376 self .last_filename = filename
373377
374378 if self .stop_level is not None :
0 commit comments