[pypy-svn] r34797 - in pypy/dist/pypy/translator: cli/test oosupport
antocuni at codespeak.net
antocuni at codespeak.net
Mon Nov 20 16:15:03 CET 2006
Author: antocuni
Date: Mon Nov 20 16:15:02 2006
New Revision: 34797
Modified:
pypy/dist/pypy/translator/cli/test/test_dict.py
pypy/dist/pypy/translator/oosupport/constant.py
Log:
Since tuples need to be fully initialized for computing the right hash
code it's necessary to initialize dictionaries after the tuples.
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 Mon Nov 20 16:15:02 2006
@@ -35,3 +35,9 @@
class TestCliConstantDict(CliTest, BaseTestRconstantdict):
def test_constant_r_dict(self):
py.test.skip('r_dict is not supported, yet')
+
+ def test_tuple_as_key(self):
+ mydict = {('r',): 42}
+ def fn(ch):
+ return mydict[(ch,)]
+ assert self.interpret(fn, ['r']) == 42
Modified: pypy/dist/pypy/translator/oosupport/constant.py
==============================================================================
--- pypy/dist/pypy/translator/oosupport/constant.py (original)
+++ pypy/dist/pypy/translator/oosupport/constant.py Mon Nov 20 16:15:02 2006
@@ -597,6 +597,8 @@
# Dictionary constants
class DictConst(AbstractConst):
+ PRIORITY = 90
+
def __init__(self, db, dict, count):
AbstractConst.__init__(self, db, dict, count)
self.name = 'DICT__%d' % count
More information about the pypy-svn
mailing list