[pypy-commit] pypy py3k: Fix BytesSetStrategy: bytes items would be converted to unicode!
amauryfa
noreply at buildbot.pypy.org
Wed Apr 2 21:51:50 CEST 2014
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r70405:7c594170c5be
Date: 2014-04-02 21:44 +0200
http://bitbucket.org/pypy/pypy/changeset/7c594170c5be/
Log: Fix BytesSetStrategy: bytes items would be converted to unicode!
diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -1202,10 +1202,10 @@
return True
def unwrap(self, w_item):
- return self.space.str_w(w_item)
+ return self.space.bytes_w(w_item)
def wrap(self, item):
- return self.space.wrap(item)
+ return self.space.wrapbytes(item)
def iter(self, w_set):
return BytesIteratorImplementation(self.space, self, w_set)
diff --git a/pypy/objspace/std/test/test_setobject.py b/pypy/objspace/std/test/test_setobject.py
--- a/pypy/objspace/std/test/test_setobject.py
+++ b/pypy/objspace/std/test/test_setobject.py
@@ -348,6 +348,11 @@
s = set([b'hello'])
assert s.pop() == b'hello'
+ def test_set_literal(self):
+ """
+ assert {b'a'}.pop() == b'a'
+ """
+
def test_compare(self):
assert set('abc') != 'abc'
raises(TypeError, "set('abc') < 42")
More information about the pypy-commit
mailing list