From e2b7fddd0ab7b382596032a2a256bd3a52440633 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Tue, 10 Mar 2026 17:17:29 +0100 Subject: [PATCH 1/4] gh-138850: Add --disable-epoll to configure --- configure | 27 +++++++++++++++++++++++++++ configure.ac | 16 ++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 95bb6ba4e84ccf..09c1694915e219 100755 --- a/configure +++ b/configure @@ -1133,6 +1133,7 @@ with_pymalloc_hugepages with_c_locale_coercion with_valgrind with_dtrace +enable_epoll with_libm with_libc enable_big_digits @@ -1856,6 +1857,7 @@ Optional Features: see Doc/library/sqlite3.rst (default is no) --enable-ipv6 enable ipv6 (with ipv4) support, see Doc/library/socket.rst (default is yes if supported) + --disable-epoll disable epoll (default is yes if supported) --enable-big-digits[=15|30] use big digits (30 or 15 bits) for Python longs (default is 30)] @@ -20960,6 +20962,29 @@ fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --disable-epoll" >&5 +printf %s "checking for --disable-epoll... " >&6; } +# Check whether --enable-epoll was given. +if test ${enable_epoll+y} +then : + enableval=$enable_epoll; if test "x$enable_epoll" = xno +then : + disable_epoll=yes +else case e in #( + e) disable_epoll=no ;; +esac +fi +else case e in #( + e) disable_epoll=no + ;; +esac +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $disable_epoll" >&5 +printf "%s\n" "$disable_epoll" >&6; } +if test "$disable_epoll" = "no" +then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for epoll_create" >&5 printf %s "checking for epoll_create... " >&6; } @@ -21041,6 +21066,8 @@ fi +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kqueue" >&5 diff --git a/configure.ac b/configure.ac index e049f568417335..681bf9eead2c8b 100644 --- a/configure.ac +++ b/configure.ac @@ -5380,8 +5380,20 @@ PY_CHECK_FUNC([symlink], [@%:@include ]) PY_CHECK_FUNC([fchdir], [@%:@include ]) PY_CHECK_FUNC([fsync], [@%:@include ]) PY_CHECK_FUNC([fdatasync], [@%:@include ]) -PY_CHECK_FUNC([epoll_create], [@%:@include ], [HAVE_EPOLL]) -PY_CHECK_FUNC([epoll_create1], [@%:@include ]) + +AC_MSG_CHECKING([for --disable-epoll]) +AC_ARG_ENABLE([epoll], + [AS_HELP_STRING([--disable-epoll], [disable epoll (default is yes if supported)])], + [AS_VAR_IF([enable_epoll], [no], [disable_epoll=yes], [disable_epoll=no])], + [disable_epoll=no] +) +AC_MSG_RESULT([$disable_epoll]) +if test "$disable_epoll" = "no" +then + PY_CHECK_FUNC([epoll_create], [@%:@include ], [HAVE_EPOLL]) + PY_CHECK_FUNC([epoll_create1], [@%:@include ]) +fi + PY_CHECK_FUNC([kqueue],[ #include #include From aa11d8291b9be7f5c930fca0a6f11a4661bc2f10 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 16:58:57 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst diff --git a/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst b/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst new file mode 100644 index 00000000000000..bec8519cfc185d --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst @@ -0,0 +1 @@ +Add ``--disable-epoll`` to ``configure`` From 0005487d7b34e6b45723aac9f20d940b7d6404f0 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 26 Mar 2026 14:20:55 +0100 Subject: [PATCH 3/4] Add docs --- Doc/library/select.rst | 7 ++++++- Doc/using/configure.rst | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Doc/library/select.rst b/Doc/library/select.rst index f6d8ce3c30ff1d..6c4a55612180a3 100644 --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -62,7 +62,7 @@ The module defines the following: *sizehint* informs epoll about the expected number of events to be registered. It must be positive, or ``-1`` to use the default. It is only - used on older systems where :c:func:`!epoll_create1` is not available; + used on older systems where :manpage:`epoll_create1(2)` is not available; otherwise it has no effect (though its value is still checked). *flags* is deprecated and completely ignored. However, when supplied, its @@ -89,6 +89,11 @@ The module defines the following: The *flags* parameter. ``select.EPOLL_CLOEXEC`` is used by default now. Use :func:`os.set_inheritable` to make the file descriptor inheritable. + .. versionchanged:: next + + When CPython is built, this function may be disabled using + :option:`--disable-epoll`. + .. function:: poll() diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst index 813127663ed8fe..350d65b2cc51db 100644 --- a/Doc/using/configure.rst +++ b/Doc/using/configure.rst @@ -463,6 +463,17 @@ General Options ``pkg-config`` options. +.. option:: --disable-epoll + + Build without ``epoll``, meaning that :py:func:`select.epoll` will not be + present even if the system provides an + :manpage:`epoll_create ` function. + This may be used on systems where :manpage:`!epoll_create` or + :manpage:`epoll_create1 ` is available + but incompatible with Linux semantics. + + .. versionadded:: next + C compiler options ------------------ From ad041d4f1519376e893c465bf493a7fbff44b92d Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 26 Mar 2026 14:44:50 +0100 Subject: [PATCH 4/4] Link from NEWS --- .../next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst b/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst index bec8519cfc185d..256f13b28772cc 100644 --- a/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst +++ b/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst @@ -1 +1 @@ -Add ``--disable-epoll`` to ``configure`` +Add :option:`--disable-epoll` to ``configure``