changeset 563:80fb59bd2342

Built-in Python constants (such as `None`) in expressions are used directly instead of being looked up from the context.
author cmlenz
date Fri, 13 Jul 2007 11:10:38 +0000
parents 21f3c4bdd964
children b3b07279b86c
files genshi/template/eval.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/genshi/template/eval.py
+++ b/genshi/template/eval.py
@@ -390,7 +390,7 @@
 
 BUILTINS = __builtin__.__dict__.copy()
 BUILTINS.update({'Markup': Markup, 'Undefined': Undefined})
-
+CONSTANTS = frozenset(['False', 'True', 'None', 'NotImplemented', 'Ellipsis'])
 
 class ASTTransformer(object):
     """General purpose base class for AST transformations.
@@ -654,7 +654,7 @@
     """
 
     def __init__(self):
-        self.locals = []
+        self.locals = [CONSTANTS, set()]
 
     def visitConst(self, node):
         if isinstance(node.value, str):
Copyright (C) 2012-2017 Edgewall Software