From 5b5a3ffa8e5650012fcf278146305aabb322b975 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Tue, 28 Jun 2016 17:35:56 +0530 Subject: netlib: condition on PY2 rather than on PY3 Let's just hope PY4 doesn't break this! --- netlib/strutils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'netlib') diff --git a/netlib/strutils.py b/netlib/strutils.py index 414b2e57..cfcdf485 100644 --- a/netlib/strutils.py +++ b/netlib/strutils.py @@ -19,12 +19,12 @@ def native(s, *encoding_opts): """ if not isinstance(s, (six.binary_type, six.text_type)): raise TypeError("%r is neither bytes nor unicode" % s) - if six.PY3: - if isinstance(s, six.binary_type): - return s.decode(*encoding_opts) - else: + if six.PY2: if isinstance(s, six.text_type): return s.encode(*encoding_opts) + else: + if isinstance(s, six.binary_type): + return s.decode(*encoding_opts) return s -- cgit v1.2.3