diff options
author | Miro HronĨok <miro@hroncok.cz> | 2019-04-11 12:02:04 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-04-12 10:08:42 -0400 |
commit | 8ace3ad64144b44d383e07ddcfb5e61848cd03b2 (patch) | |
tree | 3d7dcd6886cd83add5370360a31ec2c6b408a040 /mako | |
parent | d99330c67ce6b0ab14a3ef5b13904260e2e4fe80 (diff) | |
download | mako-8ace3ad64144b44d383e07ddcfb5e61848cd03b2.tar.gz |
Use Constant.value, not Constant.n
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.
Further corrected the previous fix for :ticket:`287` as it relied upon
an attribute that is monkeypatched by Python's ``ast`` module for some
reason, which fails if ``ast`` hasn't been imported; the correct
attribute ``Constant.value`` is now used. Also note the issue
was mis-numbered in the previous changelog note.
References: https://github.com/Pylons/pyramid_mako/issues/47
Fixes: #287
Closes: #292
Pull-request: https://github.com/sqlalchemy/mako/pull/292
Pull-request-sha: b48081aa08fdc1cb6e0196b59a2d0eff35adcd94
Change-Id: Ic3fd1975e608b6890410f3fd4ad4d949478dc45e
Diffstat (limited to 'mako')
-rw-r--r-- | mako/_ast_util.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mako/_ast_util.py b/mako/_ast_util.py index caf157d..e2c7d24 100644 --- a/mako/_ast_util.py +++ b/mako/_ast_util.py @@ -682,7 +682,7 @@ class SourceGenerator(NodeVisitor): # 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('(') |