Skip to content

Commit

Permalink
fix: remove use of deprecated Ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Dec 10, 2024
1 parent 78e366b commit bbffff2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions guppylang/ast_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,12 @@ def get_type(node: AstNode) -> "Type":
def has_empty_body(func_ast: ast.FunctionDef) -> bool:
"""Returns `True` if the body of a function definition is empty.
This is the case if the body only contains a single `pass` statement or an ellipsis
This is the case if the body only contains a single `pass` statement or a constant
`...` expression.
"""
if len(func_ast.body) == 0:
return True
if len(func_ast.body) > 1:
return False
[n] = func_ast.body
return isinstance(n, ast.Expr) and isinstance(n.value, ast.Ellipsis)
return isinstance(n, ast.Expr) and isinstance(n.value, ast.Constant)

0 comments on commit bbffff2

Please sign in to comment.