Blob Blame History Raw
From 528f14284df394686401e454230a7cf9a5e75ded Mon Sep 17 00:00:00 2001
From: Chao Guo <guochao@nutstore.net>
Date: Mon, 30 Mar 2020 16:35:37 +0800
Subject: [PATCH 1/4] fix NoneType object is not iterable when iterate over
 self._waiters

---
 aioredis/locks.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/aioredis/locks.py b/aioredis/locks.py
index 1715530b..15147c9b 100644
--- a/aioredis/locks.py
+++ b/aioredis/locks.py
@@ -18,7 +18,8 @@ async def acquire(self):
             This method blocks until the lock is unlocked, then sets it to
             locked and returns True.
             """
-            if not self._locked and all(w.cancelled() for w in self._waiters):
+            if (not self._locked and (self._waiters is None
+                                      or all(w.cancelled() for w in self._waiters))):
                 self._locked = True
                 return True


From 5c168a6abcbcaf51c93603e8c1ee085c8b8c0e9d Mon Sep 17 00:00:00 2001
From: Chao Guo <guochao@nutstore.net>
Date: Fri, 8 May 2020 16:18:38 +0800
Subject: [PATCH 2/4] avoid self._waiters of None type

---
 aioredis/locks.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/aioredis/locks.py b/aioredis/locks.py
index 15147c9b..ddd434b0 100644
--- a/aioredis/locks.py
+++ b/aioredis/locks.py
@@ -39,7 +39,7 @@ async def acquire(self):

         def _wake_up_first(self):
             """Wake up the first waiter who isn't cancelled."""
-            for fut in self._waiters:
+            for fut in (self._waiters or []):
                 if not fut.done():
                     fut.set_result(True)
                     break

From 93c9b1d0283d29e277926731900ba2d100747b53 Mon Sep 17 00:00:00 2001
From: Chao Guo <guochao@nutstore.net>
Date: Fri, 8 May 2020 16:35:50 +0800
Subject: [PATCH 3/4] reformat code

---
 aioredis/locks.py |   3 +-
 docs/conf.py      | 109 +++++++++++++++++++++++-----------------------
 2 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/aioredis/locks.py b/aioredis/locks.py
index ddd434b0..c6d61669 100644
--- a/aioredis/locks.py
+++ b/aioredis/locks.py
@@ -19,7 +19,8 @@ async def acquire(self):
             locked and returns True.
             """
             if (not self._locked and (self._waiters is None
-                                      or all(w.cancelled() for w in self._waiters))):
+                                      or all(w.cancelled()
+                                             for w in self._waiters))):
                 self._locked = True
                 return True

From c65ce5e4d90065fa111bfa35db32cfd38524cc7e Mon Sep 17 00:00:00 2001
From: Chao Guo <guochao@nutstore.net>
Date: Fri, 8 May 2020 17:33:09 +0800
Subject: [PATCH 4/4] add jeffguorg into contributors

---
 CONTRIBUTORS.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index ea3e2e37..0abc7234 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -11,6 +11,7 @@ Andrew Svetlov
 Anton Salii
 Anton Verinov
 Artem Mazur
+Chao Guo <jeffguorg>
 <cynecx>
 David Francos
 Dima Kruk