Author: Armin Rigo <[email protected]>
Branch: space-newtext
Changeset: r89197:d8f5f0260d45
Date: 2016-12-20 12:48 +0100
http://bitbucket.org/pypy/pypy/changeset/d8f5f0260d45/
Log: Add space.newlist_text(), use it instead of newlist_bytes() when
relevant
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
@@ -127,7 +127,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_text(l)
def values(self, w_dict):
iterator = self.unerase(w_dict.dstorage).itervalues
diff --git a/pypy/objspace/std/classdict.py b/pypy/objspace/std/classdict.py
--- a/pypy/objspace/std/classdict.py
+++ b/pypy/objspace/std/classdict.py
@@ -82,7 +82,7 @@
def w_keys(self, w_dict):
space = self.space
- return space.newlist_bytes(self.unerase(w_dict.dstorage).dict_w.keys())
+ return space.newlist_text(self.unerase(w_dict.dstorage).dict_w.keys())
def values(self, w_dict):
return [unwrap_cell(self.space, w_value) for w_value in
diff --git a/pypy/objspace/std/kwargsdict.py b/pypy/objspace/std/kwargsdict.py
--- a/pypy/objspace/std/kwargsdict.py
+++ b/pypy/objspace/std/kwargsdict.py
@@ -116,7 +116,7 @@
def w_keys(self, w_dict):
l = self.unerase(w_dict.dstorage)[0]
- return self.space.newlist_bytes(l[:])
+ return self.space.newlist_text(l[:])
def values(self, w_dict):
return self.unerase(w_dict.dstorage)[1][:] # to make non-resizable
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -286,6 +286,8 @@
def newlist_bytes(self, list_s):
return W_ListObject.newlist_bytes(self, list_s)
+ newlist_text = newlist_bytes
+
def newlist_unicode(self, list_u):
return W_ListObject.newlist_unicode(self, list_u)
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py
b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -1088,6 +1088,7 @@
return l
def newlist_bytes(self, l):
return l
+ newlist_text = newlist_bytes
DictObjectCls = W_DictObject
def type(self, w_obj):
if isinstance(w_obj, FakeString):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit