Skip to content

Handle carriage-return record separators in CSV decoding - #621

Merged
fabiocaccamo merged 1 commit into
fabiocaccamo:mainfrom
fhgffy:fix-csv-newline-decoding
Oct 11, 2026
Merged

fabiocaccamo merged 1 commit into
fabiocaccamo:mainfrom
fhgffy:fix-csv-newline-decoding

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Describe your changes
CSV strings with carriage-return record separators currently fail with _csv.Error, even though CR is a valid CSV line ending. Open the in-memory stream with newline="" so the CSV reader handles CR, LF, and CRLF while preserving line endings inside quoted fields.

The regression test covers all three record separators and checks that a quoted CRLF value is preserved exactly. On the unchanged source, only the CR subtest fails; with the change, all three pass.

Related issue
Found while checking CSV serializer behavior; no existing issue found for this case.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests for the proposed changes.
  • I have run the tests and there are not errors.

Validation on Python 3.14:

  • Related serializer and I/O tests: 17 passed.
  • Full unittest suite: 927 tests, 1 skipped.
  • All pre-commit hooks passed, including Ruff and mypy.
  • Built wheel and source distribution.

@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (8c3371f) to head (23202e9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #621   +/-   ##
=======================================
  Coverage   98.51%   98.51%           
=======================================
  Files          64       64           
  Lines        2430     2430           
=======================================
  Hits         2394     2394           
  Misses         36       36           
Flag Coverage Δ
unittests 98.51% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fabiocaccamo
fabiocaccamo merged commit 114faf1 into fabiocaccamo:main Oct 11, 2026
18 checks passed
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