Example #1
0
 def descr_decode(self, space, w_encoding=None, w_errors=None):
     from pypy.objspace.std.unicodeobject import (
         _get_encoding_and_errors, decode_object, unicode_from_string)
     encoding, errors = _get_encoding_and_errors(space, w_encoding,
                                                 w_errors)
     if encoding is None and errors is None:
         return unicode_from_string(space, self)
     return decode_object(space, self, encoding, errors)
Example #2
0
 def unicode_w(self, space):
     # Use the default encoding.
     w_defaultencoding = space.call_function(space.sys.get(
                                             'getdefaultencoding'))
     encoding, errors = _get_encoding_and_errors(space, w_defaultencoding,
                                                 space.w_None)
     if encoding is None and errors is None:
         return space.unicode_w(unicode_from_string(space, self))
     return space.unicode_w(decode_object(space, self, encoding, errors))
Example #3
0
 def unicode_w(self, space):
     # Use the default encoding.
     w_defaultencoding = space.call_function(space.sys.get(
                                             'getdefaultencoding'))
     encoding, errors = _get_encoding_and_errors(space, w_defaultencoding,
                                                 space.w_None)
     if encoding is None and errors is None:
         return space.unicode_w(unicode_from_string(space, self))
     return space.unicode_w(decode_object(space, self, encoding, errors))
Example #4
0
    def descr_decode(self, space, w_encoding=None, w_errors=None):
        from pypy.objspace.std.unicodeobject import (
            _get_encoding_and_errors, decode_object, unicode_from_string)
        encoding, errors = _get_encoding_and_errors(space, w_encoding,
                                                    w_errors)

        from pypy.objspace.std.bytearrayobject import W_BytearrayObject
        if (encoding is None and errors is None and
            not isinstance(self, W_BytearrayObject)):
            return unicode_from_string(space, self)
        return decode_object(space, self, encoding, errors)
Example #5
0
 def convert_to_w_unicode(self, space):
     return unicode_from_string(space, self)