From: Daniele Varrazzo Date: Mon, 26 Dec 2022 03:47:42 +0000 (+0000) Subject: fix: raise known errors before checking for signals in waiting X-Git-Tag: pool-3.2.0~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85151aff12721c503d31a98f651681ac4b2a2074;p=thirdparty%2Fpsycopg.git fix: raise known errors before checking for signals in waiting --- diff --git a/psycopg_c/psycopg_c/_psycopg/waiting.pyx b/psycopg_c/psycopg_c/_psycopg/waiting.pyx index c778c36e9..baaead63c 100644 --- a/psycopg_c/psycopg_c/_psycopg/waiting.pyx +++ b/psycopg_c/psycopg_c/_psycopg/waiting.pyx @@ -72,12 +72,9 @@ wait_c_impl(int fileno, int wait, float timeout) select_rv = poll(&input_fd, 1, timeout_ms); Py_END_ALLOW_THREADS + if (select_rv < 0) { goto error; } if (PyErr_CheckSignals()) { goto finally; } - if (select_rv < 0) { - goto error; - } - if (input_fd.events & POLLIN) { rv |= SELECT_EV_READ; } if (input_fd.events & POLLOUT) { rv |= SELECT_EV_WRITE; } @@ -120,12 +117,9 @@ wait_c_impl(int fileno, int wait, float timeout) select_rv = select(fileno + 1, &ifds, &ofds, &efds, tvptr); Py_END_ALLOW_THREADS + if (select_rv < 0) { goto error; } if (PyErr_CheckSignals()) { goto finally; } - if (select_rv < 0) { - goto error; - } - if (FD_ISSET(fileno, &ifds)) { rv |= SELECT_EV_READ; } if (FD_ISSET(fileno, &ofds)) { rv |= SELECT_EV_WRITE; }