Skip to content

Return distinct empty lists from select() - #8720

Merged
youknowone merged 1 commit into
RustPython:mainfrom
YangSiJun528:fix-select-list-identity
Sep 15, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
YangSiJun528:fix-select-list-identity

Conversation

@YangSiJun528

@YangSiJun528 YangSiJun528 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
  • I did not use AI to write the code of this patch.
  • This PR follows our AI policy

Summary

Return three distinct empty lists from select.select() instead of sharing one list, matching CPython. Remove expectedFailure from the existing regression test.

Validated with test_select, workspace and C-API tests, and Clippy.

AI assistance: Codex (gpt-6-astra) implemented the fix and ran validation.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of empty input lists in the selection functionality, ensuring each returned result is an independent empty list.

Assisted-by: Codex:gpt-6-astra
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Advanced

Run ID: 282e95ee-bda3-4987-ba94-6708ca02abbf

📥 Commits

Reviewing files that changed from the base of the PR and between 8be1439 and cb8f7e5.

⛔ Files ignored due to path filters (1)
  • Lib/test/test_select.py is excluded by !Lib/**
📒 Files selected for processing (1)
  • crates/stdlib/src/select.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The empty-input path in select now creates three independent empty PyList objects instead of cloning one list.

Changes

Select empty-result handling

Layer / File(s) Summary
Empty result construction
crates/stdlib/src/select.rs
When all three input lists are empty, select creates a separate empty list for each returned value.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: youknowone

Merge Risk: ⚪ Minimal · up to cb8f7

The change aligns empty select results with the intended behavior and presents no identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: returning distinct empty lists from select().
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the z-ca-2026 Tag to track Contribution Academy 2026 label Sep 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] test: cpython/Lib/test/test_select.py (TODO: 2)
[x] test: cpython/Lib/test/test_poll.py (TODO: 1)

dependencies:

dependent tests: (109 tests)

  • select: test_asyncio test_devpoll test_epoll test_exception_hierarchy test_file_eintr test_imaplib test_kqueue test_os test_poll test_pty test_pyrepl test_repl test_select test_smtplib test_socket test_socketserver test_ssl test_subprocess
    • http.server: test_httpservers test_logging test_robotparser test_urllib2_localnet test_xmlrpc
      • pydoc: test_enum test_pydoc
      • wsgiref.simple_server: test_wsgiref
      • xmlrpc.server: test_docxmlrpc
    • pty: test_builtin
    • pydoc:
      • pdb: test_pdb
    • selectors: test_asyncio test_selectors
      • asyncio.selector_events: test_asyncio
      • socket: test_asyncio test_external_inspection test_ftplib test_httplib test_largefile test_mailbox test_mmap test_pathlib test_poplib test_signal test_smtpnet test_stat test_support test_sys test_timeout test_urllib test_urllib2 test_urllib2net test_urllib_response test_urllibnet
      • subprocess: test_android test_asyncio test_atexit test_audit test_bz2 test_c_locale_coercion test_cmd_line test_cmd_line_script test_ctypes test_dtrace test_embed test_faulthandler test_gc test_gzip test_inspect test_json test_launcher test_msvcrt test_ntpath test_osx_env test_peg_generator test_platform test_plistlib test_py_compile test_pyrepl test_quopri test_regrtest test_runpy test_script_helper test_shutil test_site test_sqlite3 test_sys_settrace test_sysconfig test_tempfile test_threading test_traceback test_unittest test_utf8_mode test_venv test_wait3 test_webbrowser test_xpickle test_zipfile
    • subprocess:
      • ctypes.util: test_ctypes
      • ensurepip: test_ensurepip
      • platform: test__locale test__osx_support test_baseexception test_cmath test_fcntl test_math test_mimetypes test_posix test_strptime test_time test_winreg

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@ShaharNaveh ShaharNaveh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet!

tysm:)

@youknowone
youknowone merged commit 3bdd2f9 into RustPython:main Sep 15, 2026
31 checks passed
youknowone pushed a commit that referenced this pull request Sep 16, 2026
Assisted-by: Codex:gpt-6-astra

(cherry picked from commit 3bdd2f9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

z-ca-2026 Tag to track Contribution Academy 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants