Skip to content

Commit

Permalink
bytearray didn't work with socket.recv_into in python 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
andymccurdy committed Jul 21, 2014
1 parent e0de592 commit a027fd6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions redis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@
"hiredis %s. Please consider upgrading." % hiredis.__version__)
warnings.warn(msg)

HIREDIS_USE_BYTE_BUFFER = False
if HIREDIS_SUPPORTS_BYTE_BUFFER:
try:
bytearray
HIREDIS_USE_BYTE_BUFFER = True
except NameError:
pass
HIREDIS_USE_BYTE_BUFFER = True
# only use byte buffer if hiredis supports it and the Python version
# is >= 2.7
if not HIREDIS_SUPPORTS_BYTE_BUFFER or (
sys.version_info[0] == 2 and sys.version_info[1] < 7):
HIREDIS_USE_BYTE_BUFFER = False

SYM_STAR = b('*')
SYM_DOLLAR = b('$')
Expand Down

0 comments on commit a027fd6

Please sign in to comment.