]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Use == instead of is to check the Wait states
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 31 Mar 2020 05:56:11 +0000 (18:56 +1300)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 31 Mar 2020 05:56:11 +0000 (18:56 +1300)
Now they are integers so is, while it works, is an implementation
detail.

psycopg3/waiting.py

index c1743d45b83817d5e06043cd5939950d12d1ca57..f521307a85966e4bdbd3a4f51269e930e42ae271 100644 (file)
@@ -84,15 +84,15 @@ async def wait_async(gen: Generator[Tuple[int, Wait], Ready, RV]) -> RV:
         fd, s = next(gen)
         while 1:
             ev.clear()
-            if s is Wait.R:
+            if s == Wait.R:
                 loop.add_reader(fd, wakeup, Ready.R)
                 await ev.wait()
                 loop.remove_reader(fd)
-            elif s is Wait.W:
+            elif s == Wait.W:
                 loop.add_writer(fd, wakeup, Ready.W)
                 await ev.wait()
                 loop.remove_writer(fd)
-            elif s is Wait.RW:
+            elif s == Wait.RW:
                 loop.add_reader(fd, wakeup, Ready.R)
                 loop.add_writer(fd, wakeup, Ready.W)
                 await ev.wait()