]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Don't use epoll module definitions if it's not the default selector
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 16 Feb 2021 19:04:49 +0000 (20:04 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 16 Feb 2021 19:07:22 +0000 (20:07 +0100)
Close #34

psycopg3/psycopg3/waiting.py

index bfab413e1b06cbef0c1c9f712968d5c7216aee3a..e60702487deed839819ab058d44adb63eddf0c95 100644 (file)
@@ -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