GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — csv: preserve dialect conversion errors and ordering by youknowdot · Pull Request #9020 · RustPython/RustPython

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Make CSV dialect construction collect raw attributes and keyword overrides before converting fields, using Python 3.14's lookup/conversion order.

  • Preserve exceptions from strict, doublequote, and skipinitialspace truth conversion for instances, classes, native _csv.Dialect, and dialect registration.
  • Read dialect classes directly rather than instantiating them, and skip overridden attributes before lookup or conversion.
  • Continue treating failed attribute lookup as an absent attribute and applying defaults, including the default-quoting interaction with quotechar=None.
  • Use the same ordered conversion path for keyword options and native dialect construction, retaining original exception objects.

This is a coherent replacement of the existing duplicated dialect-conversion paths. A one-line strict propagation change is insufficient: the old parser also replaces exceptions, instantiates class inputs, and converts overridden attributes before applying keyword options. The shared path removes the duplicated conversion code.

The strict-conversion issue was identified while auditing #8954. That PR's attribute-lookup propagation was intentionally not copied because CPython 3.14 ignores attribute lookup failures here.

Validation

Base: bd8fdb7e5ca3e4e9f78f4f34b122a84c9dd2e2d0.
Head: 62a324e740cf0f19a219e358304bce24bd0212de.
Reference: CPython 3.14.7, Linux x86_64.

  • The new regression in the existing extra_tests/snippets/stdlib_csv.py fails the separately built, immutable current-main executable because a strict.__bool__ exception is suppressed.
  • The complete CSV snippet passes patched RustPython and CPython 3.14.7 through the actual pytest snippet runner.
  • Unmodified canonical -m test test_csv passes on baseline and patched RustPython: 134 tests, 6 skips. Existing expected-failure marking is unchanged.
  • Observation tests match CPython's field lookup/conversion order, lookup failures, class handling, keyword override behavior, and exception precedence.
  • Independent 432-case constructor review covers _csv.Dialect, reader, and writer, with 8 fields and 18 values per field. Baseline differs on 242 cases; patched semantic outcomes match all 432. The remaining 21 text-only differences are 18 preexisting validation-error wordings and 3 generic Rust integer-overflow messages versus CPython's C-int wording.
  • Unknown keyword and excess reader/writer positional arguments fail before truth conversion.

This does not change the preexisting non-ASCII delimiter limitation, native-dialect identity behavior, or unrelated CSV parsing/writing paths. Broad Rust runtime suites were not executed; only focused CSV runtime checks and compile-only aggregates are used.

Additional checks passed:

  • cargo clippy --locked --release -p rustpython-stdlib --all-targets -- -D warnings
  • cargo test --locked --release --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher --exclude rustpython-capi --no-run
  • From crates/capi: cargo test --locked --release --no-run
  • Normal commit hooks passed without changing the tested source or regression file.

AI assistance

OpenAI Codex assisted with the audit, implementation, regression tests, and validation. The runtime checks above were actually executed in the Linux environment; no untested platform behavior is claimed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@youknowdot
Preserve CSV dialect conversion errors and ordering
62a324e
Collect raw dialect fields and keyword overrides before converting them in CPython 3.14 order. Preserve truth-conversion exceptions, read classes without instantiating them, and retain defaulting for failed attribute lookup.

Use one shared parser for reader, writer, registry, and native dialect construction. Extend the existing CSV snippet with class, instance, direct-construction, lookup, override, conversion-order, and argument-binding regressions.

Assisted-by: OpenAI Codex:model identifier unavailable
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99814ff9-bc13-4d5b-ad68-ce16d35e2a87

📥 Commits

Reviewing files that changed from the base of the PR and between bd8fdb7 and 62a324e.


📒 Files selected for processing (2)
  • crates/stdlib/src/csv.rs
  • extra_tests/snippets/stdlib_csv.py

 ___________________________
< Domesticating the T-1000. >
 ---------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codspeed

codspeed Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix-csv-dialect-conversion (62a324e) with main (bd8fdb7)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

youknowone
youknowone approved these changes Oct 9, 2026
View reviewed changes
@youknowone
youknowone marked this pull request as ready for review October 9, 2026 14:28
@youknowone
youknowone merged commit 8986de2 into RustPython:main Oct 9, 2026
22 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T14:36:10.978932Z 62a324e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@youknowone youknowone youknowone approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@youknowdot @youknowone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.