[pypy-commit] pypy py3k: hg merge default

rlamy noreply at buildbot.pypy.org
Thu Oct 23 16:18:32 CEST 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r74132:c37a4c0b1d1c
Date: 2014-10-23 16:18 +0200
http://bitbucket.org/pypy/pypy/changeset/c37a4c0b1d1c/

Log:	hg merge default

diff --git a/rpython/jit/codewriter/assembler.py b/rpython/jit/codewriter/assembler.py
--- a/rpython/jit/codewriter/assembler.py
+++ b/rpython/jit/codewriter/assembler.py
@@ -249,6 +249,8 @@
             if isinstance(TYPE, lltype.FuncType):
                 name = value._obj._name
             elif TYPE == rclass.OBJECT_VTABLE:
+                if not value.name:    # this is really the "dummy" class
+                    return            #   pointer from some dict
                 name = ''.join(value.name.chars)
             else:
                 return
diff --git a/rpython/jit/metainterp/test/test_dict.py b/rpython/jit/metainterp/test/test_dict.py
--- a/rpython/jit/metainterp/test/test_dict.py
+++ b/rpython/jit/metainterp/test/test_dict.py
@@ -20,6 +20,21 @@
         res = self.interp_operations(fn, [0])
         assert not res
 
+    def test_dict_of_classes_as_values(self):
+        class A:
+            x = 5
+        class B(A):
+            x = 8
+        def fn(n):
+            A()
+            B()
+            d = self.newdict()
+            d[42] = A
+            d[43] = B
+            return d[n].x
+        res = self.interp_operations(fn, [43])
+        assert res == 8
+
     def test_dict_keys_values_items(self):
         for name, extract, expected in [('keys', None, 'k'),
                                         ('values', None, 'v'),


More information about the pypy-commit mailing list