[Zope-CVS] CVS: Packages/pypes/pypes - expression.py:1.15
Casey Duncan
casey at zope.com
Tue May 11 22:33:44 EDT 2004
Update of /cvs-repository/Packages/pypes/pypes
In directory cvs.zope.org:/tmp/cvs-serv2142
Modified Files:
expression.py
Log Message:
Use compiler api to set ast filename instead of hacking attributes directly
=== Packages/pypes/pypes/expression.py 1.14 => 1.15 ===
--- Packages/pypes/pypes/expression.py:1.14 Tue May 4 23:37:38 2004
+++ Packages/pypes/pypes/expression.py Tue May 11 22:33:41 2004
@@ -19,7 +19,7 @@
import __builtin__
from sets import Set
from copy import deepcopy
-from compiler import parse, ast
+from compiler import parse, ast, misc
from compiler.pycodegen import ExpressionCodeGenerator
from zope.interface import implements
from pypes.interfaces import IExpression
@@ -64,7 +64,7 @@
def _setAst(self, tree):
"""Set the AST for the expression and compile it to bytecode"""
- tree.filename = '<pypes expression>' # ECG requires filename attr
+ misc.set_filename('<pypes expression>', tree)
self._code = ExpressionCodeGenerator(tree).getCode()
self._tree = tree
@@ -167,7 +167,7 @@
global_ns[nm] = getattr(__builtin__, nm)
# Compile the expression to code and execute
node = ast.Expression(node)
- node.filename = '<string>' # ECG requires filename attr
+ misc.set_filename('<pypes expression>', node)
code = ExpressionCodeGenerator(node).getCode()
value = eval(code, global_ns, self._bindings)
# XXX AFAICT I can stuff any arbitrary object into a Const node and
More information about the Zope-CVS
mailing list