[pypy-svn] r14654 - in pypy/dist/pypy/objspace/flow: . test
pedronis at codespeak.net
pedronis at codespeak.net
Thu Jul 14 03:29:30 CEST 2005
Author: pedronis
Date: Thu Jul 14 03:29:28 2005
New Revision: 14654
Modified:
pypy/dist/pypy/objspace/flow/objspace.py
pypy/dist/pypy/objspace/flow/test/test_objspace.py
Log:
flowspace was looping forever on g(1,*(2,3)). fix with test.
Modified: pypy/dist/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/objspace.py (original)
+++ pypy/dist/pypy/objspace/flow/objspace.py Thu Jul 14 03:29:28 2005
@@ -271,6 +271,11 @@
return result
def unpackiterable(self, w_iterable, expected_length=None):
+ if not isinstance(w_iterable, Variable):
+ l = list(self.unwrap(w_iterable))
+ if expected_length is not None and len(l) != expected_length:
+ raise ValueError
+ return [self.wrap(x) for x in l]
if isinstance(w_iterable, Variable) and expected_length is None:
raise UnwrapException, ("cannot unpack a Variable iterable"
"without knowing its length")
Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/test/test_objspace.py (original)
+++ pypy/dist/pypy/objspace/flow/test/test_objspace.py Thu Jul 14 03:29:28 2005
@@ -555,6 +555,23 @@
traverse(visit, graph)
assert results == [Constant(4)]
+ def test_const_star_call(self):
+ def g(a=1,b=2,c=3):
+ pass
+ def f():
+ return g(1,*(2,3))
+ graph = self.codetest(f)
+ call_args = []
+ def visit(block):
+ if isinstance(block, Block):
+ for op in block.operations:
+ if op.opname == "call_args":
+ call_args.append(op)
+ traverse(visit, graph)
+ assert not call_args
+
+
+
DATA = {'x': 5,
'y': 6}
More information about the Pypy-commit
mailing list