[pypy-commit] pypy pypy-pyarray: graft changeset 0e2f0d910e8f onto branch (test and Fix for None as rdict key)

mattip noreply at buildbot.pypy.org
Wed Sep 11 20:55:45 CEST 2013


Author: Matti Picus <matti.picus at gmail.com>
Branch: pypy-pyarray
Changeset: r66916:ec6ab79a192c
Date: 2013-09-09 23:04 +0300
http://bitbucket.org/pypy/pypy/changeset/ec6ab79a192c/

Log:	graft changeset 0e2f0d910e8f onto branch (test and Fix for None as
	rdict key)

diff --git a/rpython/rtyper/rpbc.py b/rpython/rtyper/rpbc.py
--- a/rpython/rtyper/rpbc.py
+++ b/rpython/rtyper/rpbc.py
@@ -594,6 +594,9 @@
     def ll_str(self, none):
         return llstr("None")
 
+    def get_ll_eq_function(self):
+        return None
+
     def get_ll_hash_function(self):
         return ll_none_hash
 
diff --git a/rpython/rtyper/test/test_rdict.py b/rpython/rtyper/test/test_rdict.py
--- a/rpython/rtyper/test/test_rdict.py
+++ b/rpython/rtyper/test/test_rdict.py
@@ -1051,6 +1051,13 @@
         finally:
             lltype._array._check_range = original_check_range
 
+    def test_dict_with_none_key(self):
+        def func(i):
+            d = {None: i}
+            return d[None]
+        res = self.interpret(func, [42])
+        assert res == 42
+
 
 class TestStress:
 


More information about the pypy-commit mailing list