summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Reifschneider <jafo@tummy.com>2013-06-03 23:19:05 -0600
committerSean Reifschneider <jafo@tummy.com>2013-06-03 23:19:05 -0600
commit8116cfefd7a582749d13bcefbd82e3eea304d534 (patch)
tree72f820c3a52c6b701e58ab20dbaff4760028b69c
parentb7054a964aed0e6d86e853e60aab09cd0183b9f6 (diff)
downloadpython-memcached-8116cfefd7a582749d13bcefbd82e3eea304d534.tar.gz
Marking connection dead in readline().
Also fixing a docstring test.
-rw-r--r--ChangeLog11
-rw-r--r--memcache.py13
2 files changed, 15 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 57ca33b..ad10491 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+ * Fixing set_multi() so that if the server closes the connection
+ it will no longer raise AttributeError. Issue found and resolution
+ reviewed by Ben Hoyt.
+
+ * readline() now will mark the connection dead if the read fails.
+ It was just closing it before. This is related to the set_multi()
+ change but worth noting separately. Thanks to Ben Hoyt.
+
+ * Discussion of the above:
+ https://github.com/linsomniac/python-memcached/commit/b7054a964aed0e6d86e853e60aab09cd0183b9f6#commitcomment-3337557
+
Sun, 02 Jun 2013 01:08:26 -0600 Sean Reifschneider <jafo@tummy.com>
* 1.52 release.
diff --git a/memcache.py b/memcache.py
index 38c3367..6f55665 100644
--- a/memcache.py
+++ b/memcache.py
@@ -682,9 +682,7 @@ class Client(local):
... {'key1' : 'val1', 'key2' : 'val2'}, key_prefix='subspace_')
>>> len(notset_keys) == 0
True
- >>> mc.get_multi(
- ... ['subspace_key1', 'subspace_key2'])
- ... == {'subspace_key1' : 'val1', 'subspace_key2' : 'val2'}
+ >>> mc.get_multi(['subspace_key1', 'subspace_key2']) == {'subspace_key1' : 'val1', 'subspace_key2' : 'val2'}
True
Causes key 'subspace_key1' and 'subspace_key2' to be
@@ -1175,19 +1173,16 @@ class _Host(object):
if self.socket:
recv = self.socket.recv
else:
- recv = None
+ recv = lambda bufsize: ''
while True:
index = buf.find('\r\n')
if index >= 0:
break
- if recv:
- data = recv(4096)
- else:
- data = ''
+ data = recv(4096)
if not data:
# connection close, let's kill it and raise
- self.close_socket()
+ self.mark_dead('connection closed in readline()')
if raise_exception:
raise _ConnectionDeadError()
else: