python-mako/backport-optimize-make-test.patch
2020-06-24 19:58:51 +08:00

59 lines
1.5 KiB
Diff

From 00a1c26aa072cd17de8a185d9afbc70070d3eab6 Mon Sep 17 00:00:00 2001
From: Mike Bayer <mike_mp@zzzcomputing.com>
Date: Wed, 20 Mar 2019 11:15:47 -0400
Subject: [PATCH] Add Constant to _ast_util
---
doc/build/changelog.rst | 6 ++++++
mako/_ast_util.py | 3 +++
tox.ini | 2 +-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/doc/build/changelog.rst b/doc/build/changelog.rst
index 7d110f3..24c6100 100644
--- a/doc/build/changelog.rst
+++ b/doc/build/changelog.rst
@@ -8,6 +8,12 @@ Changelog
.. changelog::
:version: 1.0.6
:released: Wed Nov 9 2016
+.. changelog::
+ :tags: bug
+ :tickets: 281
+
+ Fixed an element in the AST Python generator which changed
+ for Python 3.8, causing expression generation to fail.
.. change::
:tags: feature
diff --git a/mako/_ast_util.py b/mako/_ast_util.py
index 8d19b0d..d770451 100644
--- a/mako/_ast_util.py
+++ b/mako/_ast_util.py
@@ -679,6 +679,9 @@ class SourceGenerator(NodeVisitor):
def visit_Num(self, node):
self.write(repr(node.n))
+ # newly needed in Python 3.8
+ def visit_Constant(self, node):
+ self.write(repr(node.n))
def visit_Tuple(self, node):
self.write('(')
diff --git a/tox.ini b/tox.ini
index 19016de..45d7f00 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,7 +1,7 @@
# content of: tox.ini , put in same dir as setup.py
[tox]
minversion=1.8.dev1
-envlist = py{26,27,34,35}
+envlist = py{26,27,34,35,36,37,38}
[testenv]
cov_args=--cov=mako --cov-report term --cov-report xml
--
2.23.0