From 9f61679074d000cb4254b4f67c40bd125eba50a2 Mon Sep 17 00:00:00 2001 From: Ivan Mironov Date: Fri, 22 May 2026 14:11:52 +0200 Subject: [PATCH] Add missing test for select.select() This is a follow up for https://github.com/RustPython/RustPython/pull/7948 --- extra_tests/snippets/stdlib_select.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/extra_tests/snippets/stdlib_select.py b/extra_tests/snippets/stdlib_select.py index 9afd95beca..5263bc344f 100644 --- a/extra_tests/snippets/stdlib_select.py +++ b/extra_tests/snippets/stdlib_select.py @@ -62,6 +62,16 @@ def fileno(self): resource.setrlimit(resource.RLIMIT_NOFILE, (soft_max_fds, hard_max_fds)) sockets = [s for _ in range(TOO_MANY_SELECT_FDS // 2) for s in socket.socketpair()] assert_raises(ValueError, select.select, sockets, [], [], 0) +if sys.platform != "win32": + # Try to overflow descriptor bit mask on *nix with a single item + max_fd = -1 + max_fd_sock = None + sockets.reverse() + for sock in sockets: + if sock.fileno() > max_fd: + max_fd = sock.fileno() + max_fd_sock = sock + assert_raises(ValueError, select.select, [max_fd_sock], [], [], 0) del sockets a, b = socket.socketpair() # CPython disallows this on *nix systems too.