From 1257600e1603ed57455d92758eb1da857cd61725 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 18 Nov 2019 00:18:50 -0500 Subject: Random cleanup around our usage of binary_type (#879) --- src/OpenSSL/_util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/OpenSSL/_util.py') diff --git a/src/OpenSSL/_util.py b/src/OpenSSL/_util.py index d8e3f66..9f2d724 100644 --- a/src/OpenSSL/_util.py +++ b/src/OpenSSL/_util.py @@ -1,7 +1,7 @@ import sys import warnings -from six import PY2, binary_type, text_type +from six import PY2, text_type from cryptography.hazmat.bindings.openssl.binding import Binding @@ -79,13 +79,13 @@ def native(s): :raise TypeError: The input is neither :py:class:`bytes` nor :py:class:`unicode`. """ - if not isinstance(s, (binary_type, text_type)): + if not isinstance(s, (bytes, text_type)): raise TypeError("%r is neither bytes nor unicode" % s) if PY2: if isinstance(s, text_type): return s.encode("utf-8") else: - if isinstance(s, binary_type): + if isinstance(s, bytes): return s.decode("utf-8") return s @@ -99,7 +99,7 @@ def path_string(s): :return: An instance of :py:class:`bytes`. """ - if isinstance(s, binary_type): + if isinstance(s, bytes): return s elif isinstance(s, text_type): return s.encode(sys.getfilesystemencoding()) -- cgit v1.2.1