From 0615526f80691452f2e282c363bce197c0141561 2024-11-05 15:24:33 From: M Bussonnier Date: 2024-11-05 15:24:33 Subject: [PATCH] deprecated ast attribute (#14575) --- diff --git a/IPython/core/tests/test_interactiveshell.py b/IPython/core/tests/test_interactiveshell.py index 1a8e5d0..f87d96f 100644 --- a/IPython/core/tests/test_interactiveshell.py +++ b/IPython/core/tests/test_interactiveshell.py @@ -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): diff --git a/docs/source/config/inputtransforms.rst b/docs/source/config/inputtransforms.rst index 6b7943b..33f1488 100644 --- a/docs/source/config/inputtransforms.rst +++ b/docs/source/config/inputtransforms.rst @@ -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