Remove unnecessary PY2 check and replace unicode with text_type.
This commit is contained in:
@@ -95,9 +95,7 @@ class Cursor(object):
|
|||||||
return self._nextset(False)
|
return self._nextset(False)
|
||||||
|
|
||||||
def _ensure_bytes(self, x, encoding=None):
|
def _ensure_bytes(self, x, encoding=None):
|
||||||
if not PY2:
|
if isinstance(x, text_type):
|
||||||
return x
|
|
||||||
if isinstance(x, unicode):
|
|
||||||
x = x.encode(encoding)
|
x = x.encode(encoding)
|
||||||
elif isinstance(x, (tuple, list)):
|
elif isinstance(x, (tuple, list)):
|
||||||
x = type(x)(self._ensure_bytes(v, encoding=encoding) for v in x)
|
x = type(x)(self._ensure_bytes(v, encoding=encoding) for v in x)
|
||||||
|
|||||||
Reference in New Issue
Block a user