diff --git a/tests/test_main.py b/tests/test_main.py index 8309a71..5d4f83b 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -925,11 +925,10 @@ def check_filename(self, filename, check_names): if is_literal(node): continue - if len(values) == 0 and is_deadcode(node): - continue if isinstance(node,ast.Name) and node.id=="__debug__": continue + else: # x (is/is not) None none_comparison = ( @@ -1008,8 +1007,6 @@ def check_filename(self, filename, check_names): # "%50s"%(a,) is missing an BUILD_STRING instruction which normally maps to BinOp continue - if len(values)==0 and is_deadcode(node): - continue if ( isinstance(node, ast.Name) @@ -1018,6 +1015,7 @@ def check_filename(self, filename, check_names): ): continue + if sys.version_info >= (3, 12): if ( isinstance(node, ast.Call) @@ -1051,6 +1049,11 @@ def check_filename(self, filename, check_names): # `not not x` is optimized to a single TO_BOOL continue + + # the deadcode check has to be the last check because it is expensive + if len(values)==0 and is_deadcode(node): + continue + if sys.version_info >= (3, 10): correct = len(values) >= 1 elif sys.version_info >= (3, 9) and in_finally(node):