Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r76655:40afa1747889 Date: 2015-03-31 09:43 +0200 http://bitbucket.org/pypy/pypy/changeset/40afa1747889/
Log: simplify the code and kill @specialize.memo function that makes no sense any more diff --git a/pypy/interpreter/unicodehelper.py b/pypy/interpreter/unicodehelper.py --- a/pypy/interpreter/unicodehelper.py +++ b/pypy/interpreter/unicodehelper.py @@ -24,13 +24,9 @@ self.end = end self.reason = reason -@specialize.memo() -def rpy_encode_error_handler(): - # A RPython version of the "strict" error handler. - def raise_unicode_exception_encode(errors, encoding, msg, u, - startingpos, endingpos): - raise RUnicodeEncodeError(encoding, u, startingpos, endingpos, msg) - return raise_unicode_exception_encode +def raise_unicode_exception_encode(errors, encoding, msg, u, + startingpos, endingpos): + raise RUnicodeEncodeError(encoding, u, startingpos, endingpos, msg) # ____________________________________________________________ @@ -67,5 +63,5 @@ # This is not the case with Python3. return runicode.unicode_encode_utf_8( uni, len(uni), "strict", - errorhandler=rpy_encode_error_handler(), + errorhandler=raise_unicode_exception_encode, allow_surrogates=True) 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 @@ -439,12 +439,12 @@ try: if encoding == 'ascii': u = space.unicode_w(w_object) - eh = unicodehelper.rpy_encode_error_handler() + eh = unicodehelper.raise_unicode_exception_encode return space.wrap(unicode_encode_ascii( u, len(u), None, errorhandler=eh)) if encoding == 'utf-8': u = space.unicode_w(w_object) - eh = unicodehelper.rpy_encode_error_handler() + eh = unicodehelper.raise_unicode_exception_encode return space.wrap(unicode_encode_utf_8( u, len(u), None, errorhandler=eh, allow_surrogates=True)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit