Skip to content

Commit

Permalink
Decoding in slab funcs, replacing "1" with "True" in while.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
linsomniac committed Apr 15, 2023
1 parent 6e57445 commit f5e4d4f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions memcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,13 @@ def get_stats(self, stat_args=None):
serverData = {}
data.append((name, serverData))
readline = s.readline
while 1:
while True:
line = readline()
if not line or line.decode('ascii').strip() == 'END':
if line:
line = line.decode('ascii')
if not line or line.strip() == 'END':
break
stats = line.decode('ascii').split(' ', 2)
stats = line.split(' ', 2)
serverData[stats[1]] = stats[2]

return data
Expand All @@ -347,8 +349,10 @@ def get_slab_stats(self):
data.append((name, serverData))
s.send_cmd('stats slabs')
readline = s.readline
while 1:
while True:
line = readline()
if line:
line = line.decode('ascii')
if not line or line.strip() == 'END':
break
item = line.split(' ', 2)
Expand Down Expand Up @@ -378,7 +382,7 @@ def get_slabs(self):
data.append((name, serverData))
s.send_cmd('stats items')
readline = s.readline
while 1:
while True:
line = readline()
if not line or line.strip() == 'END':
break
Expand Down

0 comments on commit f5e4d4f

Please sign in to comment.