Skip to content

Commit 67899ea

Browse files
committed
refactor: we no longer care what kind of constant the compile-time constants are
1 parent c850f20 commit 67899ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

coverage/parser.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1022,15 +1022,15 @@ def _missing__While(self, node: ast.While) -> ast.AST | None:
10221022
new_while.orelse = []
10231023
return new_while
10241024

1025-
def is_constant_expr(self, node: ast.AST) -> str | None:
1025+
def is_constant_expr(self, node: ast.AST) -> bool:
10261026
"""Is this a compile-time constant?"""
10271027
node_name = node.__class__.__name__
10281028
if node_name in ["Constant", "NameConstant", "Num"]:
1029-
return "Num"
1029+
return True
10301030
elif isinstance(node, ast.Name):
10311031
if node.id in ["True", "False", "None", "__debug__"]:
1032-
return "Name"
1033-
return None
1032+
return True
1033+
return False
10341034

10351035
# In the fullness of time, these might be good tests to write:
10361036
# while EXPR:

0 commit comments

Comments
 (0)