From f5c4482360c012e3fa2234e285a2d12011d4c9f7 Mon Sep 17 00:00:00 2001 From: Arshia Ghafoori Date: Wed, 27 Aug 2025 14:26:01 +0400 Subject: [PATCH] fix(c): fix polling for read+write --- docs/news.rst | 1 + psycopg_c/psycopg_c/_psycopg/waiting.pyx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/news.rst b/docs/news.rst index 60c3cb36a..7487d2d34 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -46,6 +46,7 @@ Psycopg 3.3.0 (unreleased) Psycopg 3.2.11 (unreleased) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +- Fix spurious readiness flags in some of the wait functions (:ticket:`#1141`). - Fix bad data on error in binary copy (:ticket:`#1147`). - Don't raise warning, and don't leak resources, if a builtin function is used as JSON dumper/loader function (:ticket:`#1165`). diff --git a/psycopg_c/psycopg_c/_psycopg/waiting.pyx b/psycopg_c/psycopg_c/_psycopg/waiting.pyx index ed04bb472..625b42d5e 100644 --- a/psycopg_c/psycopg_c/_psycopg/waiting.pyx +++ b/psycopg_c/psycopg_c/_psycopg/waiting.pyx @@ -88,8 +88,8 @@ retry_eintr: rv = 0; /* success, maybe with timeout */ if (select_rv >= 0) { - if (input_fd.events & POLLIN) { rv |= SELECT_EV_READ; } - if (input_fd.events & POLLOUT) { rv |= SELECT_EV_WRITE; } + if (input_fd.revents & POLLIN) { rv |= SELECT_EV_READ; } + if (input_fd.revents & POLLOUT) { rv |= SELECT_EV_WRITE; } } #else -- 2.47.3