From: Daniele Varrazzo Date: Tue, 30 Jan 2024 02:29:05 +0000 (+0000) Subject: fix: fix wait_async with timeout 0 X-Git-Tag: 3.2.0~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ccc131669ff4d5e67b7a93cbd7c7c413a172411;p=thirdparty%2Fpsycopg.git fix: fix wait_async with timeout 0 --- diff --git a/psycopg/psycopg/waiting.py b/psycopg/psycopg/waiting.py index 6315c0ad7..4f307b6ef 100644 --- a/psycopg/psycopg/waiting.py +++ b/psycopg/psycopg/waiting.py @@ -112,7 +112,7 @@ async def wait_async( `Ready` values when it would block. :param fileno: the file descriptor to wait on. :param timeout: timeout (in seconds) to check for other interrupt, e.g. - to allow Ctrl-C. If zero or None, wait indefinitely. + to allow Ctrl-C. If zero, wait indefinitely. :return: whatever `!gen` returns on completion. Behave like in `wait()`, but exposing an `asyncio` interface. @@ -143,7 +143,7 @@ async def wait_async( if writer: loop.add_writer(fileno, wakeup, READY_W) try: - if timeout: + if timeout is not None: try: await wait_for(ev.wait(), timeout) except TimeoutError: