# HG changeset patch # User cmlenz # Date 1202922379 0 # Node ID 2a52ea05fe9ffc19f1c709f5eb25826125e801c5 # Parent 96f35907853e8b678f9189dc35aa2e0a006e7859 Fix one Python 2.3 compatibility in the expression evaluation code. See #177. One more to go, though. diff --git a/genshi/template/directives.py b/genshi/template/directives.py --- a/genshi/template/directives.py +++ b/genshi/template/directives.py @@ -22,7 +22,7 @@ from genshi.core import QName, Stream from genshi.path import Path from genshi.template.base import TemplateRuntimeError, TemplateSyntaxError, \ - EXPR, _apply_directives + EXPR, _apply_directives, _ctxt2dict from genshi.template.eval import Expression, Suite, ExpressionASTTransformer, \ _parse @@ -725,7 +725,7 @@ def __call__(self, stream, ctxt, directives): frame = {} ctxt.push(frame) - self.suite.execute(ctxt) + self.suite.execute(_ctxt2dict(ctxt)) for event in _apply_directives(stream, ctxt, directives): yield event ctxt.pop() diff --git a/genshi/template/eval.py b/genshi/template/eval.py --- a/genshi/template/eval.py +++ b/genshi/template/eval.py @@ -439,7 +439,8 @@ node = node.__class__(*args) if lineno is not None: node.lineno = lineno - if isinstance(node, (ast.Class, ast.Function, ast.GenExpr, ast.Lambda)): + if isinstance(node, (ast.Class, ast.Function, ast.Lambda)) or \ + sys.version_info > (2, 4) and isinstance(node, ast.GenExpr): node.filename = '' # workaround for bug in pycodegen return node