summaryrefslogtreecommitdiff
path: root/memcache.py
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 /memcache.py
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.
Diffstat (limited to 'memcache.py')
-rw-r--r--memcache.py8
1 files changed, 3 insertions, 5 deletions
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)