Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r94798:ac5381b72782
Date: 2018-07-01 22:41 -0500
http://bitbucket.org/pypy/pypy/changeset/ac5381b72782/
Log: fixes from module/_sre/test
diff --git a/pypy/module/_sre/interp_sre.py b/pypy/module/_sre/interp_sre.py
--- a/pypy/module/_sre/interp_sre.py
+++ b/pypy/module/_sre/interp_sre.py
@@ -163,8 +163,8 @@
string = None
buf = None
space = self.space
- if space.isinstance_w(w_string, space.w_utf8):
- unicodestr = space.utf8_w(w_string).decode()
+ if space.isinstance_w(w_string, space.w_unicode):
+ unicodestr = space.utf8_w(w_string).decode('utf8')
length = len(unicodestr)
elif space.isinstance_w(w_string, space.w_bytes):
string = space.bytes_w(w_string)
@@ -176,6 +176,7 @@
return (length, unicodestr, string, buf)
def make_ctx(self, w_string, pos=0, endpos=sys.maxint, flags=0):
+ """Make a StrMatchContext, BufMatchContext or a Utf8MatchContext for
searching in the given w_string object."""
space = self.space
length, unicodestr, string, buf = self.getstring(w_string)
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
@@ -553,7 +553,7 @@
return w_obj.listview_utf8()
if type(w_obj) is W_SetObject or type(w_obj) is W_FrozensetObject:
return w_obj.listview_utf8()
- if (isinstance(w_obj, W_UnicodeObject) and
self._uni_uses_no_iter(w_obj)
+ if (isinstance(w_obj, W_UnicodeObject) and not
self._uses_unicode_iter(w_obj)
and w_obj.is_ascii()):
return w_obj.listview_utf8()
if isinstance(w_obj, W_ListObject) and self._uses_list_iter(w_obj):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit