Author: Armin Rigo <[email protected]>
Branch: unicode-utf8
Changeset: r92240:7655999bf67f
Date: 2017-08-24 10:48 +0200
http://bitbucket.org/pypy/pypy/changeset/7655999bf67f/
Log: Backed out changeset 3e38274ddd35
(fijal)
diff --git a/pypy/module/_pypyjson/interp_decoder.py
b/pypy/module/_pypyjson/interp_decoder.py
--- a/pypy/module/_pypyjson/interp_decoder.py
+++ b/pypy/module/_pypyjson/interp_decoder.py
@@ -295,7 +295,7 @@
i += 1
bits |= ord(ch)
if ch == '"':
- if 1 or bits & 0x80:
+ if bits & 0x80:
# the 8th bit is set, it's an utf8 strnig
content_utf8 = self.getslice(start, i-1)
content_unicode = unicodehelper.decode_utf8(self.space,
content_utf8)
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
@@ -20,7 +20,6 @@
from pypy.objspace.std.formatting import mod_format
from pypy.objspace.std.stringmethods import StringMethods
from pypy.objspace.std.util import IDTAG_SPECIAL, IDTAG_SHIFT
-from pypy.objspace.std.sliceobject import unwrap_start_stop
__all__ = ['W_UnicodeObject', 'wrapunicode', 'plain_str2unicode',
'encode_object', 'decode_object', 'unicode_from_object',
@@ -76,13 +75,6 @@
uid = (base << IDTAG_SHIFT) | IDTAG_SPECIAL
return space.newint(uid)
- def _convert_idx_params_unicode(self, space, w_start, w_end):
- """ Specialcase this for unicode - one less element in the tuple
- """
- lenself = self._len()
- start, end = unwrap_start_stop(space, lenself, w_start, w_end)
- return start, end
-
def str_w(self, space):
return space.text_w(space.str(self))
@@ -133,8 +125,8 @@
return rutf8.compute_length_utf8(self._utf8)
def _val(self, space):
- import pdb
- pdb.set_trace()
+ #import pdb
+ #pdb.set_trace()
return self._utf8.decode('utf8')
@staticmethod
@@ -454,6 +446,9 @@
i = rutf8.next_codepoint_pos(val, i)
return space.newbool(cased)
+ def _starts_ends_overflow(self, prefix):
+ return len(prefix) == 0
+
def descr_add(self, space, w_other):
try:
w_other = self.convert_arg_to_w_unicode(space, w_other)
@@ -727,26 +722,6 @@
assert rpos >= lpos # annotator hint, don't remove
return self._utf8_sliced(lpos, rpos, lgt)
- def descr_startswith(self, space, w_prefix, w_start=None, w_end=None):
- (start, end) = self._convert_idx_params_unicode(space, w_start, w_end)
- if space.isinstance_w(w_prefix, space.w_tuple):
- return self._startswith_tuple(space, w_prefix, start, end)
- return space.newbool(self._startswith(space, w_prefix, start, end))
-
- def _startswith_tuple(self, space, w_prefix, start, end):
- for w_prefix in space.fixedview(w_prefix):
- if self._startswith(space, w_prefix, start, end):
- return space.w_True
- return space.w_False
-
- def _startswith(self, space, w_prefix, start, end):
- prefix = self.convert_arg_to_w_unicode(space, w_prefix)._utf8
- if start > self._len():
- return len(prefix) == 0 # bug-to-bug cpython compatibility
- xxx
- return startswith(self._utf8, prefix, start, end)
-
-
def descr_getnewargs(self, space):
return space.newtuple([W_UnicodeObject(self._utf8, self._length)])
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit