From 3eeee0efe3aab0198571438077f98c57e45e6f9b Mon Sep 17 00:00:00 2001 From: Hanno Schlichting Date: Tue, 11 Aug 2015 22:10:21 +0200 Subject: [PATCH] Remove unnecessary PY2 check and replace unicode with text_type. --- pymysql/cursors.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pymysql/cursors.py b/pymysql/cursors.py index 6b0cad7..266e137 100644 --- a/pymysql/cursors.py +++ b/pymysql/cursors.py @@ -95,9 +95,7 @@ class Cursor(object): return self._nextset(False) def _ensure_bytes(self, x, encoding=None): - if not PY2: - return x - if isinstance(x, unicode): + if isinstance(x, text_type): x = x.encode(encoding) elif isinstance(x, (tuple, list)): x = type(x)(self._ensure_bytes(v, encoding=encoding) for v in x)