diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-11-02 06:30:07 -0700 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2018-11-03 03:21:49 -0700 |
commit | 7a0e4c7f99463c79b456a48837b5687072e1485d (patch) | |
tree | f07ff3f699f66f93d4afc62a35dffc75963af01a | |
parent | 3f1e817f24b4b51c1d1f17a7c1ef5a3bc5746751 (diff) | |
download | redis-py-7a0e4c7f99463c79b456a48837b5687072e1485d.tar.gz |
Use io package for BytesIO
Available on all supported Python versions.
-rw-r--r-- | redis/_compat.py | 5 | ||||
-rwxr-xr-x | redis/connection.py | 5 |
2 files changed, 3 insertions, 7 deletions
diff --git a/redis/_compat.py b/redis/_compat.py index ad12543..310611b 100644 --- a/redis/_compat.py +++ b/redis/_compat.py @@ -86,10 +86,6 @@ if sys.version_info[0] < 3: from itertools import imap, izip from string import letters as ascii_letters from Queue import Queue - try: - from cStringIO import StringIO as BytesIO - except ImportError: - from StringIO import StringIO as BytesIO # special unicode handling for python2 to avoid UnicodeDecodeError def safe_unicode(obj, *args): @@ -133,7 +129,6 @@ if sys.version_info[0] < 3: long = long else: from urllib.parse import parse_qs, unquote, urlparse - from io import BytesIO from string import ascii_letters from queue import Queue diff --git a/redis/connection.py b/redis/connection.py index ea65ff0..1e8b86c 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -1,5 +1,6 @@ from distutils.version import StrictVersion from itertools import chain +import io import os import socket import sys @@ -13,7 +14,7 @@ except ImportError: ssl_available = False from redis._compat import (b, xrange, imap, byte_to_chr, unicode, bytes, long, - BytesIO, nativestr, basestring, iteritems, + nativestr, basestring, iteritems, LifoQueue, Empty, Full, urlparse, parse_qs, recv, recv_into, select, unquote) from redis.exceptions import ( @@ -152,7 +153,7 @@ class SocketBuffer(object): def __init__(self, socket, socket_read_size): self._sock = socket self.socket_read_size = socket_read_size - self._buffer = BytesIO() + self._buffer = io.BytesIO() # number of bytes written to the buffer from the socket self.bytes_written = 0 # number of bytes read from the buffer |