[pypy-commit] pypy py3k: allow lookup of str subclasses in dictproxies. Comment out py2-only checks
antocuni
noreply at buildbot.pypy.org
Thu Apr 19 18:19:36 CEST 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
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):
More information about the pypy-commit
mailing list