[pypy-commit] pypy default: (cfbolz) graft 4c6c15e3e3bf to get the useful names "listview_ascii", instead
arigo
pypy.commits at gmail.com
Sat Feb 8 05:19:05 EST 2020
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r98684:d9468d86914f
Date: 2019-04-13 16:53 +0200
http://bitbucket.org/pypy/pypy/changeset/d9468d86914f/
Log: (cfbolz) graft 4c6c15e3e3bf to get the useful names
"listview_ascii", instead of the confusing listview_utf8 on default
too
original message:
Issue #2997
The problem was coming from W_UnicodeObject.listview_utf8(), which
unlike its name is supposed to return a list of *ascii* strings, not
*utf8*. Fixed, and also proceeded to a general renaming of this and
related functions and reviewing of the related code.
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1113,9 +1113,10 @@
"""
return None
- def listview_utf8(self, w_list):
- """ Return a list of unwrapped unicode out of a list of unicode. If the
- argument is not a list or does not contain only unicode, return None.
+ def listview_ascii(self, w_list):
+ """ Return a list of unwrapped **ASCII** strings out of a list of
+ unicode. If the argument is not a list, does not contain only unicode,
+ or contains a unicode with non-ascii characters, return None.
May return None anyway.
"""
return None
diff --git a/pypy/module/__pypy__/test/test_special.py b/pypy/module/__pypy__/test/test_special.py
--- a/pypy/module/__pypy__/test/test_special.py
+++ b/pypy/module/__pypy__/test/test_special.py
@@ -101,7 +101,7 @@
l = ["a", "b", "c"]
assert strategy(l) == "BytesListStrategy"
l = [u"a", u"b", u"c"]
- assert strategy(l) == "UnicodeListStrategy"
+ assert strategy(l) == "AsciiListStrategy"
l = [1.1, 2.2, 3.3]
assert strategy(l) == "FloatListStrategy"
l = range(3)
diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -411,7 +411,7 @@
popitem delitem clear \
length w_keys values items \
iterkeys itervalues iteritems \
- listview_bytes listview_utf8 listview_int \
+ listview_bytes listview_ascii listview_int \
view_as_kwargs".split()
def make_method(method):
@@ -581,7 +581,7 @@
def listview_bytes(self, w_dict):
return None
- def listview_utf8(self, w_dict):
+ def listview_ascii(self, w_dict):
return None
def listview_int(self, w_dict):
@@ -1270,7 +1270,8 @@
## assert key is not None
## return self.unerase(w_dict.dstorage).get(key, None)
- ## def listview_utf8(self, w_dict):
+ ## def listview_ascii(self, w_dict):
+ ## XXX reimplement. Also warning: must return a list of _ascii_
## return self.unerase(w_dict.dstorage).keys()
## def w_keys(self, w_dict):
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -98,13 +98,13 @@
return space.fromcache(BytesListStrategy)
elif type(w_firstobj) is W_UnicodeObject and w_firstobj.is_ascii():
- # check for all-unicodes
+ # check for all-unicodes containing only ascii
for i in range(1, len(list_w)):
item = list_w[i]
if type(item) is not W_UnicodeObject or not item.is_ascii():
break
else:
- return space.fromcache(UnicodeListStrategy)
+ return space.fromcache(AsciiListStrategy)
elif type(w_firstobj) is W_FloatObject:
# check for all-floats
@@ -198,8 +198,8 @@
return W_ListObject.from_storage_and_strategy(space, storage, strategy)
@staticmethod
- def newlist_utf8(space, list_u):
- strategy = space.fromcache(UnicodeListStrategy)
+ def newlist_ascii(space, list_u):
+ strategy = space.fromcache(AsciiListStrategy)
storage = strategy.erase(list_u)
return W_ListObject.from_storage_and_strategy(space, storage, strategy)
@@ -337,10 +337,10 @@
not use the list strategy, return None."""
return self.strategy.getitems_bytes(self)
- def getitems_utf8(self):
+ def getitems_ascii(self):
"""Return the items in the list as unwrapped unicodes. If the list does
not use the list strategy, return None."""
- return self.strategy.getitems_utf8(self)
+ return self.strategy.getitems_ascii(self)
def getitems_int(self):
"""Return the items in the list as unwrapped ints. If the list does not
@@ -801,7 +801,7 @@
def getitems_bytes(self, w_list):
return None
- def getitems_utf8(self, w_list):
+ def getitems_ascii(self, w_list):
return None
def getitems_int(self, w_list):
@@ -948,7 +948,7 @@
elif type(w_item) is W_BytesObject:
strategy = self.space.fromcache(BytesListStrategy)
elif type(w_item) is W_UnicodeObject and w_item.is_ascii():
- strategy = self.space.fromcache(UnicodeListStrategy)
+ strategy = self.space.fromcache(AsciiListStrategy)
elif type(w_item) is W_FloatObject:
strategy = self.space.fromcache(FloatListStrategy)
else:
@@ -1026,9 +1026,9 @@
w_list.lstorage = strategy.erase(byteslist[:])
return
- unilist = space.listview_utf8(w_iterable)
+ unilist = space.listview_ascii(w_iterable)
if unilist is not None:
- w_list.strategy = strategy = space.fromcache(UnicodeListStrategy)
+ w_list.strategy = strategy = space.fromcache(AsciiListStrategy)
# need to copy because intlist can share with w_iterable
w_list.lstorage = strategy.erase(unilist[:])
return
@@ -1990,7 +1990,7 @@
return self.unerase(w_list.lstorage)
-class UnicodeListStrategy(ListStrategy):
+class AsciiListStrategy(ListStrategy):
import_from_mixin(AbstractUnwrappedStrategy)
_none_value = ""
@@ -2010,7 +2010,7 @@
return type(w_obj) is W_UnicodeObject and w_obj.is_ascii()
def list_is_correct_type(self, w_list):
- return w_list.strategy is self.space.fromcache(UnicodeListStrategy)
+ return w_list.strategy is self.space.fromcache(AsciiListStrategy)
def sort(self, w_list, reverse):
l = self.unerase(w_list.lstorage)
@@ -2019,7 +2019,7 @@
if reverse:
l.reverse()
- def getitems_utf8(self, w_list):
+ def getitems_ascii(self, w_list):
return self.unerase(w_list.lstorage)
# _______________________________________________________
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
@@ -311,7 +311,7 @@
def newlist_utf8(self, list_u, is_ascii):
if is_ascii:
- return W_ListObject.newlist_utf8(self, list_u)
+ return W_ListObject.newlist_ascii(self, list_u)
return ObjSpace.newlist_utf8(self, list_u, False)
def newlist_int(self, list_i):
@@ -502,20 +502,20 @@
return w_obj.getitems_bytes()
return None
- def listview_utf8(self, w_obj):
+ def listview_ascii(self, w_obj):
# note: uses exact type checking for objects with strategies,
# and isinstance() for others. See test_listobject.test_uses_custom...
if type(w_obj) is W_ListObject:
- return w_obj.getitems_utf8()
+ return w_obj.getitems_ascii()
if type(w_obj) is W_DictObject:
- return w_obj.listview_utf8()
+ return w_obj.listview_ascii()
if type(w_obj) is W_SetObject or type(w_obj) is W_FrozensetObject:
- return w_obj.listview_utf8()
+ return w_obj.listview_ascii()
if (isinstance(w_obj, W_UnicodeObject) and self._uni_uses_no_iter(w_obj)
and w_obj.is_ascii()):
- return w_obj.listview_utf8()
+ return w_obj.listview_ascii()
if isinstance(w_obj, W_ListObject) and self._uses_list_iter(w_obj):
- return w_obj.getitems_utf8()
+ return w_obj.getitems_ascii()
return None
def listview_int(self, w_obj):
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
@@ -87,9 +87,9 @@
""" If this is a string set return its contents as a list of uwnrapped strings. Otherwise return None. """
return self.strategy.listview_bytes(self)
- def listview_utf8(self):
+ def listview_ascii(self):
""" If this is a unicode set return its contents as a list of uwnrapped unicodes. Otherwise return None. """
- return self.strategy.listview_utf8(self)
+ return self.strategy.listview_ascii(self)
def listview_int(self):
""" If this is an int set return its contents as a list of uwnrapped ints. Otherwise return None. """
@@ -713,7 +713,7 @@
def listview_bytes(self, w_set):
return None
- def listview_utf8(self, w_set):
+ def listview_ascii(self, w_set):
return None
def listview_int(self, w_set):
@@ -819,7 +819,7 @@
elif type(w_key) is W_BytesObject:
strategy = self.space.fromcache(BytesSetStrategy)
elif type(w_key) is W_UnicodeObject and w_key.is_ascii():
- strategy = self.space.fromcache(UnicodeSetStrategy)
+ strategy = self.space.fromcache(AsciiSetStrategy)
elif self.space.type(w_key).compares_by_identity():
strategy = self.space.fromcache(IdentitySetStrategy)
else:
@@ -1281,7 +1281,7 @@
return BytesIteratorImplementation(self.space, self, w_set)
-class UnicodeSetStrategy(AbstractUnwrappedSetStrategy, SetStrategy):
+class AsciiSetStrategy(AbstractUnwrappedSetStrategy, SetStrategy):
erase, unerase = rerased.new_erasing_pair("unicode")
erase = staticmethod(erase)
unerase = staticmethod(unerase)
@@ -1295,7 +1295,7 @@
def get_empty_dict(self):
return {}
- def listview_utf8(self, w_set):
+ def listview_ascii(self, w_set):
return self.unerase(w_set.sstorage).keys()
def is_correct_type(self, w_key):
@@ -1343,7 +1343,7 @@
def may_contain_equal_elements(self, strategy):
if strategy is self.space.fromcache(BytesSetStrategy):
return False
- elif strategy is self.space.fromcache(UnicodeSetStrategy):
+ elif strategy is self.space.fromcache(AsciiSetStrategy):
return False
elif strategy is self.space.fromcache(EmptySetStrategy):
return False
@@ -1434,7 +1434,7 @@
return False
if strategy is self.space.fromcache(BytesSetStrategy):
return False
- if strategy is self.space.fromcache(UnicodeSetStrategy):
+ if strategy is self.space.fromcache(AsciiSetStrategy):
return False
return True
@@ -1614,9 +1614,9 @@
w_set.sstorage = strategy.get_storage_from_unwrapped_list(byteslist)
return
- unicodelist = space.listview_utf8(w_iterable)
+ unicodelist = space.listview_ascii(w_iterable)
if unicodelist is not None:
- strategy = space.fromcache(UnicodeSetStrategy)
+ strategy = space.fromcache(AsciiSetStrategy)
w_set.strategy = strategy
w_set.sstorage = strategy.get_storage_from_unwrapped_list(unicodelist)
return
@@ -1663,7 +1663,7 @@
if type(w_item) is not W_UnicodeObject or not w_item.is_ascii():
break
else:
- w_set.strategy = space.fromcache(UnicodeSetStrategy)
+ w_set.strategy = space.fromcache(AsciiSetStrategy)
w_set.sstorage = w_set.strategy.get_storage_from_list(iterable_w)
return
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
@@ -147,7 +147,7 @@
w = self.space.wrap
w_d = self.space.newdict()
w_d.initialize_content([(w(u"a"), w(1)), (w(u"b"), w(2))])
- assert self.space.listview_utf8(w_d) == ["a", "b"]
+ assert self.space.listview_ascii(w_d) == ["a", "b"]
def test_listview_int_dict(self):
w = self.space.wrap
diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -1395,6 +1395,10 @@
l3 = [s]
assert l1[0].encode("ascii", "replace") == "???"
+ def test_unicode_bug_in_listview_utf8(self):
+ l1 = list(u'\u1234\u2345')
+ assert l1 == [u'\u1234', u'\u2345']
+
def test_list_from_set(self):
l = ['a']
l.__init__(set('b'))
diff --git a/pypy/objspace/std/test/test_liststrategies.py b/pypy/objspace/std/test/test_liststrategies.py
--- a/pypy/objspace/std/test/test_liststrategies.py
+++ b/pypy/objspace/std/test/test_liststrategies.py
@@ -3,7 +3,7 @@
from pypy.objspace.std.listobject import (
W_ListObject, EmptyListStrategy, ObjectListStrategy, IntegerListStrategy,
FloatListStrategy, BytesListStrategy, RangeListStrategy,
- SimpleRangeListStrategy, make_range_list, UnicodeListStrategy,
+ SimpleRangeListStrategy, make_range_list, AsciiListStrategy,
IntOrFloatListStrategy)
from pypy.objspace.std import listobject
from pypy.objspace.std.test.test_listobject import TestW_ListObject
@@ -21,7 +21,7 @@
assert isinstance(W_ListObject(space, [wb('a'), wb('b')]).strategy,
BytesListStrategy)
assert isinstance(W_ListObject(space, [w(u'a'), w(u'b')]).strategy,
- UnicodeListStrategy)
+ AsciiListStrategy)
assert isinstance(W_ListObject(space, [w(u'a'), wb('b')]).strategy,
ObjectListStrategy) # mixed unicode and bytes
@@ -47,7 +47,7 @@
l = W_ListObject(space, [])
assert isinstance(l.strategy, EmptyListStrategy)
l.append(w(u'a'))
- assert isinstance(l.strategy, UnicodeListStrategy)
+ assert isinstance(l.strategy, AsciiListStrategy)
l = W_ListObject(space, [])
assert isinstance(l.strategy, EmptyListStrategy)
@@ -76,9 +76,9 @@
def test_unicode_to_any(self):
space = self.space
l = W_ListObject(space, [space.wrap(u'a'), space.wrap(u'b'), space.wrap(u'c')])
- assert isinstance(l.strategy, UnicodeListStrategy)
+ assert isinstance(l.strategy, AsciiListStrategy)
l.append(space.wrap(u'd'))
- assert isinstance(l.strategy, UnicodeListStrategy)
+ assert isinstance(l.strategy, AsciiListStrategy)
l.append(space.wrap(3))
assert isinstance(l.strategy, ObjectListStrategy)
@@ -117,7 +117,7 @@
# UnicodeStrategy to ObjectStrategy
l = W_ListObject(space, [w(u'a'),w(u'b'),w(u'c')])
- assert isinstance(l.strategy, UnicodeListStrategy)
+ assert isinstance(l.strategy, AsciiListStrategy)
l.setitem(0, w(2))
assert isinstance(l.strategy, ObjectListStrategy)
@@ -145,7 +145,7 @@
# UnicodeStrategy
l = W_ListObject(space, [w(u'a'),w(u'b'),w(u'c')])
- assert isinstance(l.strategy, UnicodeListStrategy)
+ assert isinstance(l.strategy, AsciiListStrategy)
l.insert(3, w(2))
assert isinstance(l.strategy, ObjectListStrategy)
@@ -225,7 +225,7 @@
# UnicodeStrategy to ObjectStrategy
l = W_ListObject(space, [w(u'a'), w(u'b'), w(u'c')])
- assert isinstance(l.strategy, UnicodeListStrategy)
+ assert isinstance(l.strategy, AsciiListStrategy)
l.setslice(0, 1, 2, W_ListObject(space, [w(1), w(2), w(3)]))
assert isinstance(l.strategy, ObjectListStrategy)
@@ -275,7 +275,7 @@
l = W_ListObject(space, wrapitems([u"a",u"b",u"c",u"d",u"e"]))
other = W_ListObject(space, wrapitems([u"a", u"b", u"c"]))
keep_other_strategy(l, 0, 2, other.length(), other)
- assert l.strategy is space.fromcache(UnicodeListStrategy)
+ assert l.strategy is space.fromcache(AsciiListStrategy)
l = W_ListObject(space, wrapitems([1.1, 2.2, 3.3, 4.4, 5.5]))
other = W_ListObject(space, [])
@@ -345,7 +345,7 @@
empty = W_ListObject(space, [])
assert isinstance(empty.strategy, EmptyListStrategy)
empty.extend(W_ListObject(space, [w(u"a"), w(u"b"), w(u"c")]))
- assert isinstance(empty.strategy, UnicodeListStrategy)
+ assert isinstance(empty.strategy, AsciiListStrategy)
empty = W_ListObject(space, [])
assert isinstance(empty.strategy, EmptyListStrategy)
@@ -601,7 +601,7 @@
l1 = W_ListObject(self.space, [self.space.newbytes("eins"), self.space.newbytes("zwei")])
assert isinstance(l1.strategy, BytesListStrategy)
l2 = W_ListObject(self.space, [self.space.newutf8("eins", 4), self.space.newutf8("zwei", 4)])
- assert isinstance(l2.strategy, UnicodeListStrategy)
+ assert isinstance(l2.strategy, AsciiListStrategy)
l3 = W_ListObject(self.space, [self.space.newbytes("eins"), self.space.newutf8("zwei", 4)])
assert isinstance(l3.strategy, ObjectListStrategy)
@@ -611,11 +611,11 @@
w_l = self.space.newlist([self.space.newbytes('a'), self.space.newbytes('b')])
assert space.listview_bytes(w_l) == ["a", "b"]
- def test_listview_unicode(self):
+ def test_listview_ascii(self):
space = self.space
- assert space.listview_utf8(space.wrap(1)) == None
+ assert space.listview_ascii(space.wrap(1)) == None
w_l = self.space.newlist([self.space.wrap(u'a'), self.space.wrap(u'b')])
- assert space.listview_utf8(w_l) == ["a", "b"]
+ assert space.listview_ascii(w_l) == ["a", "b"]
def test_string_join_uses_listview_bytes(self):
space = self.space
@@ -664,7 +664,7 @@
assert space.listview_bytes(w_l3) == ["a", "b", "c"]
assert space.listview_bytes(w_l4) == ["a", "b", "c"]
- def test_unicode_uses_newlist_unicode(self):
+ def test_unicode_uses_newlist_ascii(self):
space = self.space
w_u = space.wrap(u"a b c")
space.newlist = None
@@ -675,10 +675,10 @@
w_l4 = space.call_method(w_u, "rsplit", space.wrap(" "))
finally:
del space.newlist
- assert space.listview_utf8(w_l) == [u"a", u"b", u"c"]
- assert space.listview_utf8(w_l2) == [u"a", u"b", u"c"]
- assert space.listview_utf8(w_l3) == [u"a", u"b", u"c"]
- assert space.listview_utf8(w_l4) == [u"a", u"b", u"c"]
+ assert space.listview_ascii(w_l) == [u"a", u"b", u"c"]
+ assert space.listview_ascii(w_l2) == [u"a", u"b", u"c"]
+ assert space.listview_ascii(w_l3) == [u"a", u"b", u"c"]
+ assert space.listview_ascii(w_l4) == [u"a", u"b", u"c"]
def test_pop_without_argument_is_fast(self):
space = self.space
@@ -719,10 +719,10 @@
w_l = W_ListObject(space, [space.newbytes("a"), space.newbytes("b")])
assert self.space.listview_bytes(w_l) == ["a", "b"]
- def test_listview_unicode_list(self):
+ def test_listview_ascii_list(self):
space = self.space
w_l = W_ListObject(space, [space.wrap(u"a"), space.wrap(u"b")])
- assert self.space.listview_utf8(w_l) == [u"a", u"b"]
+ assert self.space.listview_ascii(w_l) == [u"a", u"b"]
def test_listview_int_list(self):
space = self.space
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
@@ -80,7 +80,7 @@
def test_create_set_from_list(self):
from pypy.interpreter.baseobjspace import W_Root
- from pypy.objspace.std.setobject import BytesSetStrategy, ObjectSetStrategy, UnicodeSetStrategy
+ from pypy.objspace.std.setobject import BytesSetStrategy, ObjectSetStrategy
from pypy.objspace.std.floatobject import W_FloatObject
w = self.space.wrap
@@ -105,8 +105,6 @@
w_list = self.space.iter(W_ListObject(self.space, [w(u"1"), w(u"2"), w(u"3")]))
w_set = W_SetObject(self.space)
_initialize_set(self.space, w_set, w_list)
- #assert w_set.strategy is self.space.fromcache(UnicodeSetStrategy)
- #assert w_set.strategy.unerase(w_set.sstorage) == {u"1":None, u"2":None, u"3":None}
w_list = W_ListObject(self.space, [w("1"), w(2), w("3")])
w_set = W_SetObject(self.space)
diff --git a/pypy/objspace/std/test/test_setstrategies.py b/pypy/objspace/std/test/test_setstrategies.py
--- a/pypy/objspace/std/test/test_setstrategies.py
+++ b/pypy/objspace/std/test/test_setstrategies.py
@@ -2,7 +2,7 @@
from pypy.objspace.std.setobject import (
BytesIteratorImplementation, BytesSetStrategy, EmptySetStrategy,
IntegerIteratorImplementation, IntegerSetStrategy, ObjectSetStrategy,
- UnicodeIteratorImplementation, UnicodeSetStrategy)
+ UnicodeIteratorImplementation, AsciiSetStrategy)
from pypy.objspace.std.listobject import W_ListObject
class TestW_SetStrategies:
@@ -26,8 +26,8 @@
s = W_SetObject(self.space, self.wrapped(["a", "b"]))
assert s.strategy is self.space.fromcache(BytesSetStrategy)
- #s = W_SetObject(self.space, self.wrapped([u"a", u"b"]))
- #assert s.strategy is self.space.fromcache(UnicodeSetStrategy)
+ s = W_SetObject(self.space, self.wrapped([u"a", u"b"]))
+ assert s.strategy is self.space.fromcache(AsciiSetStrategy)
def test_switch_to_object(self):
s = W_SetObject(self.space, self.wrapped([1,2,3,4,5]))
@@ -42,7 +42,7 @@
def test_switch_to_unicode(self):
s = W_SetObject(self.space, self.wrapped([]))
s.add(self.space.wrap(u"six"))
- assert s.strategy is self.space.fromcache(UnicodeSetStrategy)
+ assert s.strategy is self.space.fromcache(AsciiSetStrategy)
def test_symmetric_difference(self):
s1 = W_SetObject(self.space, self.wrapped([1,2,3,4,5]))
diff --git a/pypy/objspace/std/test/test_unicodeobject.py b/pypy/objspace/std/test/test_unicodeobject.py
--- a/pypy/objspace/std/test/test_unicodeobject.py
+++ b/pypy/objspace/std/test/test_unicodeobject.py
@@ -30,9 +30,9 @@
space.warn = prev_warn
assert len(warnings) == 2
- def test_listview_unicode(self):
+ def test_listview_ascii(self):
w_str = self.space.newutf8('abcd', 4)
- assert self.space.listview_utf8(w_str) == list("abcd")
+ assert self.space.listview_ascii(w_str) == list("abcd")
def test_new_shortcut(self):
space = self.space
diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -129,9 +129,10 @@
# Returns ascii-encoded str
return space.text_w(encode_object(space, self, 'ascii', 'strict'))
- def listview_utf8(self):
- assert self.is_ascii()
- return _create_list_from_unicode(self._utf8)
+ def listview_ascii(self):
+ if self.is_ascii():
+ return list(self._utf8)
+ return None
def ord(self, space):
if self._len() != 1:
@@ -480,7 +481,7 @@
_StringMethods_descr_join = descr_join
def descr_join(self, space, w_list):
- l = space.listview_utf8(w_list)
+ l = space.listview_ascii(w_list)
if l is not None and self.is_ascii():
if len(l) == 1:
return space.newutf8(l[0], len(l[0]))
@@ -1808,12 +1809,6 @@
W_UnicodeObject.typedef.flag_sequence_bug_compat = True
-def _create_list_from_unicode(value):
- # need this helper function to allow the jit to look inside and inline
- # listview_unicode
- return [s for s in value]
-
-
W_UnicodeObject.EMPTY = W_UnicodeObject('', 0)
More information about the pypy-commit
mailing list