Author: Armin Rigo <ar...@tunes.org> Branch: py3.5 Changeset: r87064:464f767392fb Date: 2016-09-13 10:34 +0200 http://bitbucket.org/pypy/pypy/changeset/464f767392fb/
Log: Move this method as a global function 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 @@ -77,21 +77,8 @@ def unicode_w(self, space): return self._value - @jit.elidable - @jit.call_shortcut def identifier_w(self, space): - identifier = self._utf8 - if identifier is not None: - return identifier - u = self._value - eh = unicodehelper.rpy_encode_error_handler() - try: - identifier = unicode_encode_utf_8(u, len(u), None, - errorhandler=eh) - except unicodehelper.RUnicodeEncodeError as ue: - raise wrap_encode_error(space, ue) - self._utf8 = identifier - return identifier + return g_identifier_w(self, space) def listview_unicode(self): return _create_list_from_unicode(self._value) @@ -1307,6 +1294,22 @@ return unicodehelper.encode_utf8(space, u''.join(result), allow_surrogates=allow_surrogates) +@jit.elidable +@jit.call_shortcut +def g_identifier_w(self, space): + """This is a global function because of @jit.call_shortcut""" + identifier = self._utf8 + if identifier is not None: + return identifier + u = self._value + eh = unicodehelper.rpy_encode_error_handler() + try: + identifier = unicode_encode_utf_8(u, len(u), None, + errorhandler=eh) + except unicodehelper.RUnicodeEncodeError as ue: + raise wrap_encode_error(space, ue) + self._utf8 = identifier + return identifier _repr_function, _ = make_unicode_escape_function( pass_printable=True, unicode_output=True, quotes=True, prefix='') _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit