Author: Matti Picus <[email protected]>
Branch: py3.5
Changeset: r93799:d46f72070fa8
Date: 2018-02-11 11:18 -0500
http://bitbucket.org/pypy/pypy/changeset/d46f72070fa8/
Log: test, fix for unicode keys. Shouldn't there be a case for
ByteDictStrategy?
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -767,7 +767,7 @@
def switch_to_text_strategy(self, w_dict):
w_obj = self.unerase(w_dict.dstorage)
- strategy = self.space.fromcache(BytesDictStrategy)
+ strategy = self.space.fromcache(UnicodeDictStrategy)
str_dict = strategy.unerase(strategy.get_empty_storage())
w_dict.set_strategy(strategy)
w_dict.dstorage = strategy.erase(str_dict)
diff --git a/pypy/objspace/std/test/test_mapdict.py
b/pypy/objspace/std/test/test_mapdict.py
--- a/pypy/objspace/std/test/test_mapdict.py
+++ b/pypy/objspace/std/test/test_mapdict.py
@@ -802,6 +802,18 @@
d[1] = 3
a.__dict__ = {}
+ def test_dict_limit(self):
+ class A(object):
+ pass
+ a = A()
+ for n in (40, 1000):
+ for i in range(n):
+ v = str(i).encode().decode('utf8')
+ setattr(a, v, i)
+ for i in range(n):
+ v = str(i).encode().decode('utf8')
+ assert (n, getattr(a, v)) == (n, i)
+
def test_dict_clear_bug(self):
class A(object):
pass
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit