diff options
Diffstat (limited to 'src/OpenSSL')
-rw-r--r-- | src/OpenSSL/_util.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/OpenSSL/_util.py b/src/OpenSSL/_util.py index cf8b888..cdcacc8 100644 --- a/src/OpenSSL/_util.py +++ b/src/OpenSSL/_util.py @@ -1,7 +1,7 @@ import sys import warnings -from six import PY3, binary_type, text_type +from six import PY2, binary_type, text_type from cryptography.hazmat.bindings.openssl.binding import Binding @@ -81,12 +81,12 @@ def native(s): """ if not isinstance(s, (binary_type, text_type)): raise TypeError("%r is neither bytes nor unicode" % s) - if PY3: - if isinstance(s, binary_type): - return s.decode("utf-8") - else: + if PY2: if isinstance(s, text_type): return s.encode("utf-8") + else: + if isinstance(s, binary_type): + return s.decode("utf-8") return s @@ -107,12 +107,12 @@ def path_string(s): raise TypeError("Path must be represented as bytes or unicode string") -if PY3: +if PY2: def byte_string(s): - return s.encode("charmap") + return s else: def byte_string(s): - return s + return s.encode("charmap") # A marker object to observe whether some optional arguments are passed any |