io.TextIoWrapper.reconfigure to always flush#7281
Conversation
📝 WalkthroughWalkthroughThe PR fixes a panic in TextIOWrapper's reentrant Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@extra_tests/snippets/stdlib_io.py`:
- Line 2: Remove the unused imports BytesIO and StringIO from the import
statement in stdlib_io.py; edit the line that currently imports BufferedReader,
BytesIO, FileIO, RawIOBase, StringIO, TextIOWrapper and delete BytesIO and
StringIO so only actually used symbols (e.g., BufferedReader, FileIO, RawIOBase,
TextIOWrapper) remain, resolving the F401 lint warnings.
- Around line 63-86: The test fails early with AttributeError because Gh6588
lacks a flush method, so TextIOWrapper.writelines() raises instead of exercising
the reentrant reconfigure-path; update the Gh6588 class to implement a
flush(self) method (e.g., forward to self.textio.flush() or a no-op) so
TextIOWrapper (created as textio via TextIOWrapper(raw, ...)) can call flush and
the test will exercise the reentrant call in write/reconfigure rather than
short-circuiting on missing flush.
Sorry, something went wrong.
ca390dc
into
RustPython:main
Mar 1, 2026
* Always flush on reconfigure (io.TextWrapper) * Add test
fix #6588
Summary by CodeRabbit
Bug Fixes
Tests