[pypy-commit] pypy py3k: Fix a corner case where a key of module.__dict__ could be retrieved
amauryfa
noreply at buildbot.pypy.org
Tue Feb 10 22:25:16 CET 2015
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r75815:8b50f6d3aebe
Date: 2015-02-10 22:20 +0100
http://bitbucket.org/pypy/pypy/changeset/8b50f6d3aebe/
Log: Fix a corner case where a key of module.__dict__ could be retrieved
as a bytes object.
Probably fixes translation as well
diff --git a/pypy/objspace/std/celldict.py b/pypy/objspace/std/celldict.py
--- a/pypy/objspace/std/celldict.py
+++ b/pypy/objspace/std/celldict.py
@@ -123,7 +123,7 @@
def w_keys(self, w_dict):
space = self.space
l = self.unerase(w_dict.dstorage).keys()
- return space.newlist_bytes(l)
+ return space.newlist_unicode(l)
def values(self, w_dict):
iterator = self.unerase(w_dict.dstorage).itervalues
diff --git a/pypy/objspace/std/test/test_celldict.py b/pypy/objspace/std/test/test_celldict.py
--- a/pypy/objspace/std/test/test_celldict.py
+++ b/pypy/objspace/std/test/test_celldict.py
@@ -106,6 +106,11 @@
assert "s" not in d
assert F() not in d
+ def test_reversed(self):
+ import __pypy__
+ name = next(__pypy__.reversed_dict(__pypy__.__dict__))
+ assert isinstance(name, str)
+
class TestModuleDictImplementation(BaseTestRDictImplementation):
StrategyClass = ModuleDictStrategy
More information about the pypy-commit
mailing list