diff --git a/coverage/parser.py b/coverage/parser.py index 19267a718..0f7e353a3 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -678,7 +678,7 @@ class NodeList(ast.AST): """ def __init__(self, body: Sequence[ast.AST]) -> None: self.body = body - self.lineno = body[0].lineno + self.lineno = body[0].lineno # type: ignore[attr-defined] # TODO: Shouldn't the cause messages join with "and" instead of "or"? @@ -824,7 +824,7 @@ def line_for_node(self, node: ast.AST) -> TLineNo: if handler is not None: return handler(node) else: - return node.lineno + return node.lineno # type: ignore[attr-defined, no-any-return] # First lines: _line__* # @@ -1020,10 +1020,10 @@ def _missing__While(self, node: ast.While) -> ast.AST | None: if not body_nodes: return None # Make a synthetic While-true node. - new_while = ast.While() - new_while.lineno = body_nodes.lineno - new_while.test = ast.Name() - new_while.test.lineno = body_nodes.lineno + new_while = ast.While() # type: ignore[call-arg] + new_while.lineno = body_nodes.lineno # type: ignore[attr-defined] + new_while.test = ast.Name() # type: ignore[call-arg] + new_while.test.lineno = body_nodes.lineno # type: ignore[attr-defined] new_while.test.id = "True" assert hasattr(body_nodes, "body") new_while.body = body_nodes.body