[pypy-svn] r30340 - in pypy/dist/pypy/translator/cli: . test
antocuni at codespeak.net
antocuni at codespeak.net
Fri Jul 21 23:26:52 CEST 2006
Author: antocuni
Date: Fri Jul 21 23:26:47 2006
New Revision: 30340
Modified:
pypy/dist/pypy/translator/cli/metavm.py
pypy/dist/pypy/translator/cli/test/test_dict.py
Log:
We need to special case the ll_current_value method of
DictItemsIterator(XXX, Void) (see the comment). The test has changed
to fail without this fix.
Modified: pypy/dist/pypy/translator/cli/metavm.py
==============================================================================
--- pypy/dist/pypy/translator/cli/metavm.py (original)
+++ pypy/dist/pypy/translator/cli/metavm.py Fri Jul 21 23:26:47 2006
@@ -44,7 +44,17 @@
generator.call_signature(signature)
else:
generator.call_method(this.concretetype, method_name)
-
+
+ # special case: DictItemsIterator(XXX,
+ # Void).ll_current_value needs to return an int32 because
+ # we can't use 'void' as a parameter of a Generic. This
+ # means that after the call to ll_current_value there will
+ # be a value on the stack, and we need to explicitly pop
+ # it.
+ if isinstance(this.concretetype, ootype.DictItemsIterator) and \
+ this.concretetype._VALUETYPE is ootype.Void and \
+ method_name == 'll_current_value':
+ generator.ilasm.pop()
class _CallMethod(_Call):
def render(self, generator, op):
Modified: pypy/dist/pypy/translator/cli/test/test_dict.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_dict.py (original)
+++ pypy/dist/pypy/translator/cli/test/test_dict.py Fri Jul 21 23:26:47 2006
@@ -17,8 +17,8 @@
def f():
d = {1: None, 2: None, 3: None}
total = 0
- for k in d:
- total += k
+ for key, value in d.iteritems():
+ total += key
return total
assert self.interpret(f, []) == 6
More information about the Pypy-commit
mailing list