Author: Ronan Lamy <[email protected]>
Branch: translation-cleanup
Changeset: r57700:bac9f9052480
Date: 2012-10-01 11:59 +0100
http://bitbucket.org/pypy/pypy/changeset/bac9f9052480/
Log: Test cellvar handling
diff --git a/pypy/objspace/flow/bytecode.py b/pypy/objspace/flow/bytecode.py
--- a/pypy/objspace/flow/bytecode.py
+++ b/pypy/objspace/flow/bytecode.py
@@ -5,7 +5,8 @@
cpython_code_signature)
from pypy.tool.stdlib_opcode import (host_bytecode_spec, EXTENDED_ARG,
HAVE_ARGUMENT)
-from pypy.interpreter.astcompiler.consts import CO_GENERATOR, CO_NEWLOCALS
+from pypy.interpreter.astcompiler.consts import (CO_GENERATOR, CO_NEWLOCALS,
+ CO_VARARGS, CO_VARKEYWORDS)
from pypy.interpreter.nestedscope import Cell
from pypy.objspace.flow.model import Constant
diff --git a/pypy/objspace/flow/test/test_objspace.py
b/pypy/objspace/flow/test/test_objspace.py
--- a/pypy/objspace/flow/test/test_objspace.py
+++ b/pypy/objspace/flow/test/test_objspace.py
@@ -1054,6 +1054,15 @@
with py.test.raises(FlowingError):
self.codetest(f)
+ def test_cellvar(self):
+ def f():
+ x = 5
+ return x
+ lambda: x # turn x into a cell variable
+ graph = self.codetest(f)
+ assert len(graph.startblock.exits) == 1
+ assert graph.startblock.exits[0].target == graph.returnblock
+
DATA = {'x': 5,
'y': 6}
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit