From: Denis Laxalde Date: Sun, 17 Oct 2021 18:59:58 +0000 (+0200) Subject: Fix wait_epoll() when the fd is read- and write-ready X-Git-Tag: 3.0.5~10^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0380464ec9e3f9c5738638203aac2480c6162164;p=thirdparty%2Fpsycopg.git Fix wait_epoll() when the fd is read- and write-ready We follow the implementation of EpollSelector.select(). The test_wait_ready() introduced previously added now passes for wait_epoll(). --- diff --git a/psycopg/psycopg/waiting.py b/psycopg/psycopg/waiting.py index 2c2f75bc9..59bbd6559 100644 --- a/psycopg/psycopg/waiting.py +++ b/psycopg/psycopg/waiting.py @@ -232,11 +232,12 @@ def wait_epoll( while not fileevs: fileevs = epoll.poll(timeout) ev = fileevs[0][1] + ready = 0 if ev & ~select.EPOLLOUT: - s = Ready.R - else: - s = Ready.W - s = gen.send(s) + ready = Ready.R + if ev & ~select.EPOLLIN: + ready |= Ready.W + s = gen.send(ready) evmask = poll_evmasks[s] epoll.modify(fileno, evmask)