⚡ Sangsakala Proxy 🏠 Home
Skip to content

Require callable write method for CSV writers - #9635

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix/csv-writer-require-callable-write-20261103
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix/csv-writer-require-callable-write-20261103

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Require csv.writer's first argument to provide a callable write attribute. CPython rejects both an object that is itself callable but lacks write and an object whose write attribute is not callable; the latter previously failed only on the first writerow call in RustPython. Attribute lookup errors continue to propagate.

This is scoped to the write-method check. Existing differences in argument binding and the timing of writer allocation are not addressed.

Validation

  • Compared the check and ordering with CPython 3.15.0 csv_writer and reproduced rejection of bare callables and non-callable write values, as well as propagation of a property error.
  • Independent source review and normal commit hooks passed.
  • RustPython was not built or run locally; no tests were added or changed. Hosted CI can run the existing test_csv suite.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

Comment thread crates/stdlib/src/csv.rs
return Err(vm.new_type_error(r#"argument 1 must have a "write" method"#));
};
if !write.is_callable() {
return Err(vm.new_type_error(r#"argument 1 must have a "write" method"#));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

don't repeat this

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.

2 participants