# HG changeset patch # User hodgestar # Date 1359201216 0 # Node ID 8f00b78c6a593964d5447b23e120434b9784718c # Parent 2d9346a9935269eab1f650be9ee31fc5079ee1fc Stop try to lex for matching braces in interpolation if the token_re matches an empty string. This fixes the infinite loop triggered by the test suite as a result of the change to Python 2.7 describe in http://bugs.python.org/issue16152 and reported in http://genshi.edgewall.org/ticket/540. diff --git a/genshi/template/interpolation.py b/genshi/template/interpolation.py --- a/genshi/template/interpolation.py +++ b/genshi/template/interpolation.py @@ -115,7 +115,9 @@ level = 1 while level: match = token_re.match(text, pos) - if match is None: + if match is None or not match.group(): + # if there isn't a match or the match is the empty + # string, we're not going to match up braces ever raise TemplateSyntaxError('invalid syntax', filepath, *textpos[1:]) pos = match.end()