Author: Armin Rigo <ar...@tunes.org> Branch: py3.5 Changeset: r90213:691bc97b8dc9 Date: 2017-02-19 18:47 +0100 http://bitbucket.org/pypy/pypy/changeset/691bc97b8dc9/
Log: hg merge default diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py --- a/rpython/annotator/unaryop.py +++ b/rpython/annotator/unaryop.py @@ -699,7 +699,7 @@ if enc not in ('ascii', 'latin-1', 'utf-8'): raise AnnotatorError("Encoding %s not supported for unicode" % (enc,)) return SomeString(no_nul=self.no_nul) - method_encode.can_only_throw = [UnicodeEncodeError] + method_encode.can_only_throw = [] class __extend__(SomeString): diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py --- a/rpython/rlib/runicode.py +++ b/rpython/rlib/runicode.py @@ -110,21 +110,10 @@ def ll_unicode_error_decode(errors, encoding, msg, s, startingpos, endingpos): raise UnicodeDecodeError(encoding, s, startingpos, endingpos, msg) -def ll_unicode_error_encode(errors, encoding, msg, u, startingpos, endingpos): - raise UnicodeEncodeError(encoding, u, startingpos, endingpos, msg) - # ____________________________________________________________ # utf-8 -utf8_code_length = [ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, # 00-0F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, # 70-7F +_utf8_code_length = ''.join(map(chr, [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 80-8F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -133,7 +122,7 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, # D0-DF 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, # E0-EF 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 # F0-F4 - F5-FF -] +])) # if you can't use the @elidable version, call str_decode_utf_8_impl() # directly @@ -190,7 +179,7 @@ pos += 1 continue - n = utf8_code_length[ordch1] + n = ord(_utf8_code_length[ordch1 - 0x80]) if pos + n > size: if not final: break @@ -365,7 +354,7 @@ s = NonConstant(u'?????') size = NonConstant(12345) errors = NonConstant('strict') - errorhandler = ll_unicode_error_encode + # no errorhandler needed for rtyper/rstr.py allow_surrogates = NonConstant(True) return unicode_encode_utf_8_elidable(s, size, errors, errorhandler, allow_surrogates=allow_surrogates) diff --git a/rpython/rtyper/rstr.py b/rpython/rtyper/rstr.py --- a/rpython/rtyper/rstr.py +++ b/rpython/rtyper/rstr.py @@ -390,10 +390,8 @@ from rpython.rlib import runicode s = hlunicode(ll_s) assert s is not None - errorhandler = runicode.ll_unicode_error_encode bytes = runicode.unicode_encode_utf_8_elidable( - s, len(s), 'strict', - errorhandler=errorhandler, allow_surrogates=True) + s, len(s), 'strict', None, True) return self.ll.llstr(bytes) def rtype_method_encode(self, hop): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit