summaryrefslogtreecommitdiff
path: root/redis/connection.py
diff options
context:
space:
mode:
authorandy <andy@whiskeymedia.com>2012-10-07 22:32:50 -0700
committerandy <andy@whiskeymedia.com>2012-10-07 22:32:50 -0700
commit520ddbd47c96055a88c09d58e490328634dd59cb (patch)
tree8b6b5cfe76cbc11b0f03a5b7dafb9aa8eff61c9b /redis/connection.py
parent6e7a710fe480816d2abe27263a9975332c939c6f (diff)
downloadredis-py-520ddbd47c96055a88c09d58e490328634dd59cb.tar.gz
High precision floating point values are now properly sent to the Redis server.
Fixes #227
Diffstat (limited to 'redis/connection.py')
-rw-r--r--redis/connection.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 0322feb..118e99f 100644
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -4,7 +4,7 @@ import socket
import sys
from redis._compat import (b, xrange, imap, byte_to_chr, unicode, bytes, long,
- BytesIO, nativestr)
+ BytesIO, nativestr, basestring)
from redis.exceptions import (
RedisError,
ConnectionError,
@@ -313,7 +313,9 @@ class Connection(object):
"Return a bytestring representation of the value"
if isinstance(value, bytes):
return value
- if not isinstance(value, unicode):
+ if isinstance(value, float):
+ value = repr(value)
+ if not isinstance(value, basestring):
value = str(value)
if isinstance(value, unicode):
value = value.encode(self.encoding, self.encoding_errors)