Skip to content

Commit f5e4d4f

Browse files
committed
Decoding in slab funcs, replacing "1" with "True" in while.
The slab functions needed a decode (as noted in #175), adapted that patch. Also converted "while 1" to "while True" while I was in there.
1 parent 6e57445 commit f5e4d4f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

memcache.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,13 @@ def get_stats(self, stat_args=None):
323323
serverData = {}
324324
data.append((name, serverData))
325325
readline = s.readline
326-
while 1:
326+
while True:
327327
line = readline()
328-
if not line or line.decode('ascii').strip() == 'END':
328+
if line:
329+
line = line.decode('ascii')
330+
if not line or line.strip() == 'END':
329331
break
330-
stats = line.decode('ascii').split(' ', 2)
332+
stats = line.split(' ', 2)
331333
serverData[stats[1]] = stats[2]
332334

333335
return data
@@ -347,8 +349,10 @@ def get_slab_stats(self):
347349
data.append((name, serverData))
348350
s.send_cmd('stats slabs')
349351
readline = s.readline
350-
while 1:
352+
while True:
351353
line = readline()
354+
if line:
355+
line = line.decode('ascii')
352356
if not line or line.strip() == 'END':
353357
break
354358
item = line.split(' ', 2)
@@ -378,7 +382,7 @@ def get_slabs(self):
378382
data.append((name, serverData))
379383
s.send_cmd('stats items')
380384
readline = s.readline
381-
while 1:
385+
while True:
382386
line = readline()
383387
if not line or line.strip() == 'END':
384388
break

0 commit comments

Comments
 (0)