From 5e24c605d2926e23273089058741fe69e1b3030a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 19 Jun 2019 14:45:20 +0200 Subject: _compat: Change the to_native_str into a to_unicode_str function. The to_native_str function was supposed to produce Unicode decoded native strings for python2 and python3. Upon further consideration this doesn't make much sense since under python2 it would need to decode the bytes into a Unicode string and turn it back into a python2 str. The ability to use the replacement character requires us to use a Unicode string under python2 as well. --- python/olm/session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python/olm/session.py') diff --git a/python/olm/session.py b/python/olm/session.py index cf66582..f81b727 100644 --- a/python/olm/session.py +++ b/python/olm/session.py @@ -40,7 +40,7 @@ from future.utils import bytes_to_native_str # pylint: disable=no-name-in-module from _libolm import ffi, lib # type: ignore -from ._compat import URANDOM, to_bytearray, to_bytes, to_native_str +from ._compat import URANDOM, to_bytearray, to_bytes, to_unicode_str from ._finalize import track_for_finalization # This is imported only for type checking purposes @@ -318,7 +318,7 @@ class Session(object): plaintext_buffer, max_plaintext_length ) self._check_error(plaintext_length) - plaintext = to_native_str( + plaintext = to_unicode_str( ffi.unpack(plaintext_buffer, plaintext_length), errors=errors ) -- cgit v1.2.3