From 00dbeb6cc2a3e1de76714e6450b177e5537a00a5 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 16 Feb 2021 20:04:49 +0100 Subject: [PATCH] Don't use epoll module definitions if it's not the default selector Close #34 --- psycopg3/psycopg3/waiting.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/psycopg3/psycopg3/waiting.py b/psycopg3/psycopg3/waiting.py index bfab413e1..e60702487 100644 --- a/psycopg3/psycopg3/waiting.py +++ b/psycopg3/psycopg3/waiting.py @@ -196,13 +196,6 @@ async def wait_conn_async(gen: PQGenConn[RV]) -> RV: return rv -poll_evmasks = { - Wait.R: select.EPOLLONESHOT | select.EPOLLIN, - Wait.W: select.EPOLLONESHOT | select.EPOLLOUT, - Wait.RW: select.EPOLLONESHOT | select.EPOLLIN | select.EPOLLOUT, -} - - def wait_epoll( gen: PQGen[RV], fileno: int, timeout: Optional[float] = None ) -> RV: @@ -247,5 +240,12 @@ if ( is selectors.EpollSelector ): wait = wait_epoll + + poll_evmasks = { + Wait.R: select.EPOLLONESHOT | select.EPOLLIN, + Wait.W: select.EPOLLONESHOT | select.EPOLLOUT, + Wait.RW: select.EPOLLONESHOT | select.EPOLLIN | select.EPOLLOUT, + } + else: wait = wait_selector -- 2.47.2