diff --git a/backport-Decoding-in-slab-funcs-replacing-1-with-True-in-while.patch b/backport-Decoding-in-slab-funcs-replacing-1-with-True-in-while.patch new file mode 100644 index 0000000..4a68a4e --- /dev/null +++ b/backport-Decoding-in-slab-funcs-replacing-1-with-True-in-while.patch @@ -0,0 +1,57 @@ +From f5e4d4f39cee3d3489242387409af0de917fb84c Mon Sep 17 00:00:00 2001 +From: Sean Reifschneider +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 + diff --git a/python-memcached.spec b/python-memcached.spec index a5f7137..52e4662 100644 --- a/python-memcached.spec +++ b/python-memcached.spec @@ -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 - 1.59-3 +- Decoding in slab funcs, replacing "1" with "True" in while + * Mon Jan 10 2022 yanglongkang - 1.59-2 - delete python-nose Buildrequires