Opened 11 years ago
Last modified 6 years ago
#590 new defect
"yield from" expression is unsupported in template
Reported by: | vagran.ast@… | Owned by: | hodgestar |
---|---|---|---|
Priority: | major | Milestone: | 0.8 |
Component: | Template processing | Version: | 0.6 |
Keywords: | python3 | Cc: |
Description
Version 0.7.
I have such snippet in a template:
<?python def GetParentList(catList, nesting): for c in catList: if c.id == cat.id: continue c.nesting = nesting yield c yield from GetParentList(c.children, nesting + 1) ?>
which causes exception:
File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/loader.py", line 236, in load filename, encoding=encoding) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/loader.py", line 274, in _instantiate allow_exec=self.allow_exec) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/markup.py", line 67, in __init__ allow_exec=allow_exec) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/base.py", line 418, in __init__ self._stream = self._parse(source, encoding) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/markup.py", line 95, in _parse lookup=self.lookup) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/eval.py", line 93, in __init__ filename=filename, lineno=lineno, xform=xform) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/eval.py", line 463, in _compile new_source = ASTCodeGenerator(tree).code File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 43, in __init__ self.visit(tree) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 91, in visit ret = visitor(node) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 98, in visit_Module self.visit(n) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 91, in visit ret = visitor(node) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 156, in visit_FunctionDef self.visit(statement) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 91, in visit ret = visitor(node) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 237, in visit_For self.visit(statement) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 91, in visit ret = visitor(node) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 480, in visit_Expr self.visit(node.value) File "/usr/local/lib/python3.3/dist-packages/Genshi-0.7-py3.3-linux-x86_64.egg/genshi/template/astutil.py", line 90, in visit raise Exception('Unhandled node type %r' % type(node)) Exception: Unhandled node type <class '_ast.YieldFrom'>
Change History (2)
comment:1 Changed 11 years ago by hodgestar
- Owner changed from cmlenz to hodgestar
comment:2 Changed 6 years ago by hodgestar
- Milestone set to 0.8
Note: See
TracTickets for help on using
tickets.