Skip to content

Commit

Permalink
deprecated ast attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Nov 5, 2024
1 parent 39c7d0e commit 806dba2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion IPython/core/tests/test_interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ class Negator(ast.NodeTransformer):
"""Negates all number literals in an AST."""

def visit_Num(self, node):
node.n = -node.n
node.value = -node.value
return node

def visit_Constant(self, node):
Expand Down
2 changes: 1 addition & 1 deletion docs/source/config/inputtransforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mathematical frameworks that want to handle e.g. ``1/3`` as a precise fraction::
class IntegerWrapper(ast.NodeTransformer):
"""Wraps all integers in a call to Integer()"""
def visit_Num(self, node):
if isinstance(node.n, int):
if isinstance(node.value, int):
return ast.Call(func=ast.Name(id='Integer', ctx=ast.Load()),
args=[node], keywords=[])
return node

0 comments on commit 806dba2

Please sign in to comment.