diff options
author | andy <andy@whiskeymedia.com> | 2012-10-07 22:32:50 -0700 |
---|---|---|
committer | andy <andy@whiskeymedia.com> | 2012-10-07 22:32:50 -0700 |
commit | 520ddbd47c96055a88c09d58e490328634dd59cb (patch) | |
tree | 8b6b5cfe76cbc11b0f03a5b7dafb9aa8eff61c9b /redis/connection.py | |
parent | 6e7a710fe480816d2abe27263a9975332c939c6f (diff) | |
download | redis-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.py | 6 |
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) |