summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Reifschneider <jafo@tummy.com>2010-12-15 21:31:10 -0700
committerSean Reifschneider <jafo@tummy.com>2010-12-15 21:31:10 -0700
commit2e7b170b1d78de44b3ddf9c343e82e69fbd050e4 (patch)
treefc912ebc1be04def9ca25a44dc7f461f75606d34
parent001dadd0e75dead077086a4d4e1d08cd55c0190f (diff)
downloadpython-memcached-2e7b170b1d78de44b3ddf9c343e82e69fbd050e4.tar.gz
Fixing Bug #509712: "TypeError: 'NoneType' object is unsubscriptable"
Also fixed some other similar code to not have issues with that. Also added changelog entries for the last two patches.
-rw-r--r--ChangeLog9
-rw-r--r--memcache.py8
2 files changed, 12 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e99992..11814a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+ * Fixing Bug #509712: "TypeError: 'NoneType' object is unsubscriptable"
+ Also fixed some other similar code to not have issues with that.
+
+ * Fixing Bug #628339: Read from server sometimes fails. Patch by Jeremy
+ Cowles.
+
+ * Fixing Bug #633553: Add stat arguments support to get_stats(). Patch
+ by Ryan Lane.
+
* Changing the license to the PSF License.
* Removing Evan's e-mail address at his request, changing authorship to
diff --git a/memcache.py b/memcache.py
index f7bc013..173bf16 100644
--- a/memcache.py
+++ b/memcache.py
@@ -445,7 +445,7 @@ class Client(local):
try:
server.send_cmd(cmd)
line = server.readline()
- if line.strip() =='NOT_FOUND': return None
+ if line == None or line.strip() =='NOT_FOUND': return None
return int(line)
except socket.error, msg:
if isinstance(msg, tuple): msg = msg[1]
@@ -869,7 +869,7 @@ class Client(local):
if not line:
line = server.readline()
- if line[:5] == 'VALUE':
+ if line and line[:5] == 'VALUE':
resp, rkey, flags, len, cas_id = line.split()
return (rkey, int(flags), int(len), int(cas_id))
else:
@@ -878,10 +878,8 @@ class Client(local):
def _expectvalue(self, server, line=None):
if not line:
line = server.readline()
- if not line:
- return (None, None, None)
- if line[:5] == 'VALUE':
+ if line and line[:5] == 'VALUE':
resp, rkey, flags, len = line.split()
flags = int(flags)
rlen = int(len)