From: Daniele Varrazzo Date: Tue, 31 Mar 2020 05:56:11 +0000 (+1300) Subject: Use == instead of is to check the Wait states X-Git-Tag: 3.0.dev0~639 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=435dfdfba4a3a7ac60d1964f0d879154f9f6ec3f;p=thirdparty%2Fpsycopg.git Use == instead of is to check the Wait states Now they are integers so is, while it works, is an implementation detail. --- diff --git a/psycopg3/waiting.py b/psycopg3/waiting.py index c1743d45b..f521307a8 100644 --- a/psycopg3/waiting.py +++ b/psycopg3/waiting.py @@ -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()