@@ -52,10 +52,6 @@ def check_jump_targets(self, code):
5252 tgt .opname == 'RETURN_VALUE' ):
5353 self .fail (f'{ instr .opname } at { instr .offset } '
5454 f'jumps to { tgt .opname } at { tgt .offset } ' )
55- # JUMP_IF_*_OR_POP jump to conditional jump
56- if '_OR_POP' in instr .opname and 'JUMP_IF_' in tgt .opname :
57- self .fail (f'{ instr .opname } at { instr .offset } '
58- f'jumps to { tgt .opname } at { tgt .offset } ' )
5955
6056 def check_lnotab (self , code ):
6157 "Check that the lnotab byte offsets are sensible."
@@ -384,38 +380,36 @@ def f():
384380
385381 def test_elim_jump_to_uncond_jump3 (self ):
386382 # Intentionally use two-line expressions to test issue37213.
387- # JUMP_IF_FALSE_OR_POP to JUMP_IF_FALSE_OR_POP --> JUMP_IF_FALSE_OR_POP to non-jump
383+ # POP_JUMP_IF_FALSE to POP_JUMP_IF_FALSE --> POP_JUMP_IF_FALSE to non-jump
388384 def f (a , b , c ):
389385 return ((a and b )
390386 and c )
391387 self .check_jump_targets (f )
392388 self .check_lnotab (f )
393- self .assertEqual (count_instr_recursively (f , 'JUMP_IF_FALSE_OR_POP ' ), 2 )
394- # JUMP_IF_TRUE_OR_POP to JUMP_IF_TRUE_OR_POP --> JUMP_IF_TRUE_OR_POP to non-jump
389+ self .assertEqual (count_instr_recursively (f , 'POP_JUMP_IF_FALSE ' ), 2 )
390+ # POP_JUMP_IF_TRUE to POP_JUMP_IF_TRUE --> POP_JUMP_IF_TRUE to non-jump
395391 def f (a , b , c ):
396392 return ((a or b )
397393 or c )
398394 self .check_jump_targets (f )
399395 self .check_lnotab (f )
400- self .assertEqual (count_instr_recursively (f , 'JUMP_IF_TRUE_OR_POP ' ), 2 )
396+ self .assertEqual (count_instr_recursively (f , 'POP_JUMP_IF_TRUE ' ), 2 )
401397 # JUMP_IF_FALSE_OR_POP to JUMP_IF_TRUE_OR_POP --> POP_JUMP_IF_FALSE to non-jump
402398 def f (a , b , c ):
403399 return ((a and b )
404400 or c )
405401 self .check_jump_targets (f )
406402 self .check_lnotab (f )
407- self .assertNotInBytecode (f , 'JUMP_IF_FALSE_OR_POP' )
408- self .assertInBytecode (f , 'JUMP_IF_TRUE_OR_POP' )
409- self .assertInBytecode (f , 'POP_JUMP_IF_FALSE' )
410- # JUMP_IF_TRUE_OR_POP to JUMP_IF_FALSE_OR_POP --> POP_JUMP_IF_TRUE to non-jump
403+ self .assertEqual (count_instr_recursively (f , 'POP_JUMP_IF_FALSE' ), 1 )
404+ self .assertEqual (count_instr_recursively (f , 'POP_JUMP_IF_TRUE' ), 1 )
405+ # POP_JUMP_IF_TRUE to POP_JUMP_IF_FALSE --> POP_JUMP_IF_TRUE to non-jump
411406 def f (a , b , c ):
412407 return ((a or b )
413408 and c )
414409 self .check_jump_targets (f )
415410 self .check_lnotab (f )
416- self .assertNotInBytecode (f , 'JUMP_IF_TRUE_OR_POP' )
417- self .assertInBytecode (f , 'JUMP_IF_FALSE_OR_POP' )
418- self .assertInBytecode (f , 'POP_JUMP_IF_TRUE' )
411+ self .assertEqual (count_instr_recursively (f , 'POP_JUMP_IF_FALSE' ), 1 )
412+ self .assertEqual (count_instr_recursively (f , 'POP_JUMP_IF_TRUE' ), 1 )
419413
420414 def test_elim_jump_to_uncond_jump4 (self ):
421415 def f ():
0 commit comments