Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r54542:f5af4b8cad47
Date: 2012-04-19 16:11 +0200
http://bitbucket.org/pypy/pypy/changeset/f5af4b8cad47/

Log:    allow lookup of str subclasses in dictproxies. Comment out py2-only
        checks

diff --git a/pypy/objspace/std/dictproxyobject.py 
b/pypy/objspace/std/dictproxyobject.py
--- a/pypy/objspace/std/dictproxyobject.py
+++ b/pypy/objspace/std/dictproxyobject.py
@@ -20,7 +20,7 @@
     def getitem(self, w_dict, w_key):
         space = self.space
         w_lookup_type = space.type(w_key)
-        if space.is_w(w_lookup_type, space.w_unicode):
+        if space.is_true(space.issubtype(w_lookup_type, space.w_unicode)):
             return self.getitem_str(w_dict, space.str_w(w_key))
         else:
             return None
diff --git a/pypy/objspace/std/test/test_dictproxy.py 
b/pypy/objspace/std/test/test_dictproxy.py
--- a/pypy/objspace/std/test/test_dictproxy.py
+++ b/pypy/objspace/std/test/test_dictproxy.py
@@ -31,9 +31,10 @@
         assert 'a' in NotEmpty.__dict__
         class substr(str): pass
         assert substr('a') in NotEmpty.__dict__
-        assert u'a' in NotEmpty.__dict__
-        assert NotEmpty.__dict__[u'a'] == 1
-        assert u'\xe9' not in NotEmpty.__dict__
+        # the following are only for py2
+        ## assert u'a' in NotEmpty.__dict__
+        ## assert NotEmpty.__dict__[u'a'] == 1
+        ## assert u'\xe9' not in NotEmpty.__dict__
 
     def test_dictproxyeq(self):
         class a(object):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to