Skip to content

Commit

Permalink
Use Constant.value, not Constant.n
Browse files Browse the repository at this point in the history
Since Python 3.8, class ast.Constant is used for all constants.
Old classes ast.Num, ast.Str, ast.Bytes, ast.NameConstant and
ast.Ellipsis are still available, but they will be removed in
future Python releases.

Constants have values, but not always ns.

See sqlalchemy#287 (comment)
See python/cpython#9445
Fixes Pylons/pyramid_mako#47
  • Loading branch information
hroncok committed Apr 11, 2019
1 parent d99330c commit b48081a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mako/_ast_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def visit_Num(self, node):

# newly needed in Python 3.8
def visit_Constant(self, node):
self.write(repr(node.n))
self.write(repr(node.value))

def visit_Tuple(self, node):
self.write('(')
Expand Down

0 comments on commit b48081a

Please sign in to comment.