# HG changeset patch # User cmlenz # Date 1202922379 0 # Node ID 17f9061d0f747586ee35b8d4e0ddc6a9aabf1f97 # Parent 0fcb1c0d7c20b98b587437aa8dc34032f568d740 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