◐ Shell
reader mode source ↗
Skip to content

Align patches at test_types.py#8126

Open
ShaharNaveh wants to merge 3 commits into
RustPython:mainfrom
ShaharNaveh:update-test-types
Open

Align patches at test_types.py#8126
ShaharNaveh wants to merge 3 commits into
RustPython:mainfrom
ShaharNaveh:update-test-types

Conversation

@ShaharNaveh

@ShaharNaveh ShaharNaveh commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Summary by CodeRabbit

  • Chores
    • Enhanced I/O module with additional explicit method definitions and properties for text-based operations, improving API structure and clarity.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

_TextIOBase in the VM's _io module gains explicit _unsupported stub implementations for read, write, truncate, readline, and detach, plus a newlines property getter that returns None, mirroring the existing encoding getter pattern.

Changes

_TextIOBase stubs and newlines getter

Layer / File(s) Summary
_TextIOBase _unsupported stubs and newlines property
crates/vm/src/stdlib/_io.rs
Adds read, write, truncate, readline, and detach as _unsupported method stubs, and a newlines getter returning None, to the _TextIOBase Python class.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hop hop, the base class grows,
With stubs for reads and writes in rows,
newlines returns a gentle None,
detach and truncate—nicely done!
The rabbit checks each method off,
No unsupported path too rough. 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Align patches at test_types.py' does not align with the actual changes, which focus on implementing missing IO methods in the VM stdlib. Update the title to accurately reflect the main change, such as 'Add missing methods to _TextIOBase in stdlib _io.rs' or 'Implement _TextIOBase methods for read, write, truncate, readline, and detach'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

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

[x] lib: cpython/Lib/io.py
[x] lib: cpython/Lib/_pyio.py
[ ] test: cpython/Lib/test/test_io.py (TODO: 14)
[x] test: cpython/Lib/test/test_bufio.py
[x] test: cpython/Lib/test/test_fileio.py (TODO: 1)
[ ] test: cpython/Lib/test/test_memoryio.py (TODO: 27)

dependencies:

  • io

dependent tests: (108 tests)

  • io: test__colorize test_android test_argparse test_ast test_asyncio test_base64 test_buffer test_bufio test_builtin test_bz2 test_calendar test_cmd test_cmd_line_script test_codecs test_compile test_compileall test_compiler_assemble test_concurrent_futures test_configparser test_contextlib test_csv test_dbm_dumb test_descr test_dis test_email test_enum test_file test_fileinput test_fileio test_ftplib test_generated_cases test_getpass test_gzip test_hashlib test_http_cookiejar test_httplib test_httpservers test_importlib test_inspect test_io test_json test_largefile test_logging test_lzma test_mailbox test_marshal test_memoryio test_memoryview test_mimetypes test_minidom test_multibytecodec test_optparse test_pathlib test_pdb test_peg_generator test_pickle test_pickletools test_platform test_plistlib test_pprint test_print test_profile test_pstats test_pty test_pulldom test_pydoc test_pyexpat test_pyrepl test_quopri test_regrtest test_robotparser test_sax test_shlex test_shutil test_site test_smtplib test_socket test_socketserver test_subprocess test_support test_sys test_tarfile test_tempfile test_threadedtempfile test_timeit test_tokenize test_traceback test_types test_typing test_unittest test_univnewlines test_urllib test_urllib2 test_uuid test_wave test_webbrowser test_winconsoleio test_wsgiref test_xml_dom_xmlbuilder test_xml_etree test_xml_etree_c test_xmlrpc test_xpickle test_zipapp test_zipfile test_zipimport test_zoneinfo test_zstd

[x] lib: cpython/Lib/types.py
[ ] test: cpython/Lib/test/test_types.py (TODO: 5)

dependencies:

  • types

dependent tests: (57 tests)

  • types: test_annotationlib test_ast test_asyncgen test_asyncio test_builtin test_call test_code test_collections test_compile test_compiler_assemble test_coroutines test_descr test_dis test_doctest test_dtrace test_dynamicclassattribute test_email test_enum test_exception_group test_fstring test_funcattrs test_generators test_genericalias test_global test_hmac test_importlib test_inspect test_listcomps test_marshal test_monitoring test_opcache test_optimizer test_os test_pdb test_positional_only_arg test_pprint test_pyclbr test_pydoc test_raise test_rlcompleter test_string test_subclassinit test_subprocess test_tempfile test_threading test_trace test_traceback test_type_aliases test_type_annotations test_type_params test_types test_typing test_unittest test_userdict test_xml_etree test_xml_etree_c test_xxlimited

Legend:

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

@coderabbitai coderabbitai Bot 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.

Hide comment

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/vm/src/stdlib/_io.rs`:
- Around line 807-810: The readline method in _TextIOBase is missing an optional
size parameter in its signature. Update the readline method to accept an
optional size argument (which can be of type i32 or similar numeric type with a
default value) while keeping the implementation unchanged. This ensures that
calls like readline(1) will properly pass the argument to the method rather than
causing a TypeError, allowing the _unsupported call to handle it with the
correct UnsupportedOperation error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: cb0c7ea7-91e6-48fe-ae33-086e59215c6f

📥 Commits

Reviewing files that changed from the base of the PR and between 93fbe4f and 67f7ff8.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant