Decoding in slab funcs, replacing 1 with True in while
This commit is contained in:
parent
ab3ed7f83d
commit
8d86b29ef2
@ -0,0 +1,57 @@
|
||||
From f5e4d4f39cee3d3489242387409af0de917fb84c Mon Sep 17 00:00:00 2001
|
||||
From: Sean Reifschneider <sean@realgo.com>
|
||||
Date: Sat, 15 Apr 2023 14:45:18 -0600
|
||||
Subject: [PATCH] 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.
|
||||
---
|
||||
memcache.py | 14 +++++++++-----
|
||||
1 file 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
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
Name: python-memcached
|
||||
Version: 1.59
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: A Python memcached client library
|
||||
License: Python
|
||||
URL: https://github.com/linsomniac/python-memcached
|
||||
Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
|
||||
BuildArch: noarch
|
||||
|
||||
Patch0: backport-Decoding-in-slab-funcs-replacing-1-with-True-in-while.patch
|
||||
|
||||
%bcond_without python3
|
||||
%bcond_without check
|
||||
@ -43,7 +44,7 @@ Summary: %{summary}
|
||||
%{python3_sitelib}/python_memcached-%{version}-py*.egg-info/
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version}
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
|
||||
|
||||
%build
|
||||
@ -56,6 +57,9 @@ Summary: %{summary}
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri May 10 2024 xiejing <xiejing@kylinos.cn> - 1.59-3
|
||||
- Decoding in slab funcs, replacing "1" with "True" in while
|
||||
|
||||
* Mon Jan 10 2022 yanglongkang <yanglongkang@huawei.com> - 1.59-2
|
||||
- delete python-nose Buildrequires
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user