diff options
author | Sean Reifschneider <sean@realgo.com> | 2023-04-15 14:45:18 -0600 |
---|---|---|
committer | Sean Reifschneider <sean@realgo.com> | 2023-04-15 14:45:18 -0600 |
commit | f5e4d4f39cee3d3489242387409af0de917fb84c (patch) | |
tree | 72439859de65d5711cb5fae49b3276f07772c3ce /memcache.py | |
parent | 6e57445fd3be869e9928ef609a107342500c8e97 (diff) | |
download | python-memcached-f5e4d4f39cee3d3489242387409af0de917fb84c.tar.gz |
Decoding in slab funcs, replacing "1" with "True" in while.
The slab functions needed a decode (as noted in
https://github.com/linsomniac/python-memcached/pull/175), adapted that
patch. Also converted "while 1" to "while True" while I was in there.
Diffstat (limited to 'memcache.py')
-rw-r--r-- | memcache.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/memcache.py b/memcache.py index 8c38e56..1aa9987 100644 --- a/memcache.py +++ b/memcache.py @@ -323,11 +323,13 @@ class Client(threading.local): 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 @@ -347,8 +349,10 @@ class Client(threading.local): 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) @@ -378,7 +382,7 @@ class Client(threading.local): 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 |