Author: Manuel Jacob Branch: refactor-str-types Changeset: r65654:cfc74ab95eda Date: 2013-07-25 19:29 +0200 http://bitbucket.org/pypy/pypy/changeset/cfc74ab95eda/
Log: Remove use of unicode.is* which isn't supported in RPython. diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py --- a/pypy/objspace/std/stringmethods.py +++ b/pypy/objspace/std/stringmethods.py @@ -336,12 +336,12 @@ v = self._val(space) if len(v) == 1: c = v[0] - return space.newbool(c.islower()) + return space.newbool(self._islower(c)) cased = False for idx in range(len(v)): - if v[idx].isupper(): + if self._isupper(v[idx]): return space.w_False - elif not cased and v[idx].islower(): + elif not cased and self._islower(v[idx]): cased = True return space.newbool(cased) @@ -357,12 +357,12 @@ for pos in range(0, len(input)): ch = input[pos] - if ch.isupper(): + if self._isupper(ch): if previous_is_cased: return space.w_False previous_is_cased = True cased = True - elif ch.islower(): + elif self._islower(ch): if not previous_is_cased: return space.w_False cased = True @@ -376,12 +376,12 @@ v = self._val(space) if len(v) == 1: c = v[0] - return space.newbool(c.isupper()) + return space.newbool(self._isupper(c)) cased = False for idx in range(len(v)): - if v[idx].islower(): + if self._islower(v[idx]): return space.w_False - elif not cased and v[idx].isupper(): + elif not cased and self._isupper(v[idx]): cased = True return space.newbool(cased) @@ -535,7 +535,7 @@ while True: # find the beginning of the next word while i < length: - if not value[i].isspace(): + if not self._isspace(value[i]): break # found i += 1 else: @@ -546,7 +546,7 @@ j = length # take all the rest of the string else: j = i + 1 - while j < length and not value[j].isspace(): + while j < length and not self._isspace(value[j]): j += 1 maxsplit -= 1 # NB. if it's already < 0, it stays < 0 @@ -575,7 +575,7 @@ while True: # starting from the end, find the end of the next word while i >= 0: - if not value[i].isspace(): + if not self._isspace(value[i]): break # found i -= 1 else: @@ -587,7 +587,7 @@ j = -1 # take all the rest of the string else: j = i - 1 - while j >= 0 and not value[j].isspace(): + while j >= 0 and not self._isspace(value[j]): j -= 1 maxsplit -= 1 # NB. if it's already < 0, it stays < 0 @@ -692,11 +692,11 @@ if left: #print "while %d < %d and -%s- in -%s-:"%(lpos, rpos, value[lpos],w_chars) - while lpos < rpos and value[lpos].isspace(): + while lpos < rpos and self._isspace(value[lpos]): lpos += 1 if right: - while rpos > lpos and value[rpos - 1].isspace(): + while rpos > lpos and self._isspace(value[rpos - 1]): rpos -= 1 assert rpos >= lpos # annotator hint, don't remove 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 @@ -89,25 +89,25 @@ _builder = UnicodeBuilder def _isupper(self, ch): - return ch.isupper() + return unicodedb.isupper(ord(ch)) def _islower(self, ch): - return ch.islower() + return unicodedb.islower(ord(ch)) def _istitle(self, ch): - return ch.istitle() + return unicodedb.istitle(ord(ch)) def _isspace(self, ch): - return ch.isspace() + return unicodedb.isspace(ord(ch)) def _isalpha(self, ch): - return ch.isalpha() + return unicodedb.isalpha(ord(ch)) def _isalnum(self, ch): - return ch.isalnum() + return unicodedb.isalnum(ord(ch)) def _isdigit(self, ch): - return ch.isdigit() + return unicodedb.isdigit(ord(ch)) def _iscased(self, ch): return unicodedb.iscased(ord(ch)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit