diff --git a/pymtl3/dsl/AstHelper.py b/pymtl3/dsl/AstHelper.py index 1506ad4ad..d4b282880 100644 --- a/pymtl3/dsl/AstHelper.py +++ b/pymtl3/dsl/AstHelper.py @@ -145,15 +145,15 @@ def _get_full_name_starting_py39( self, input_node ): low = up = None - if isinstance( lower, ast.Num ): - low = node.slice.lower.n + if isinstance( lower, ast.Constant ): + low = node.slice.lower.value elif isinstance( lower, ast.Name ): x = lower.id if x in self.globals: low = (False, x) elif x in self.closure: low = (True, x) - if isinstance( upper, ast.Num ): - up = node.slice.upper.n + if isinstance( upper, ast.Constant ): + up = node.slice.upper.value elif isinstance( upper, ast.Name ): x = upper.id if x in self.globals: up = (False, x) @@ -175,8 +175,8 @@ def _get_full_name_starting_py39( self, input_node ): if isinstance( v, ast.Attribute ): # s.sel, may be constant self.visit( v ) - elif isinstance( v, ast.Num ): - n = v.n + elif isinstance( v, ast.Constant ): + n = v.value elif isinstance( v, ast.Name ): x = v.id if x in self.globals: n = (False, x) diff --git a/pymtl3/dsl/ComponentLevel3.py b/pymtl3/dsl/ComponentLevel3.py index 470a8a6f9..faaae2a05 100644 --- a/pymtl3/dsl/ComponentLevel3.py +++ b/pymtl3/dsl/ComponentLevel3.py @@ -146,8 +146,8 @@ def _create_assign_lambda( s, o, lamb ): lineno=1+idx, col_offset=5+len(var), ), slice=ast.Index( - value=ast.Num( - n=idx, + value=ast.Constant( + value=idx, lineno=1+idx, col_offset=19+len(var), ), ),