Skip to content

Reject stray carriage returns instead of truncating - #9

Merged
yoch merged 1 commit into
masterfrom
fix/crlf-strict
Oct 20, 2026
Merged

yoch merged 1 commit into
masterfrom
fix/crlf-strict

Conversation

@yoch

@yoch yoch commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Follow-up to #8.

The CRLF fix stopped the feature loop at every \r, so a file using
CR-only line endings (or containing a stray \r) silently loaded only
its first record. A \r is now treated as a line ending only when it is
followed by \n (CRLF) or EOF; otherwise strtol() reports the
malformed index, as it did before.

Added a regression test for a CR-only file.

Verified locally: 19 tests pass with numpy 1.26.4 and numpy 2.5.4,
Cython 3.3.0.

The CRLF fix treated every '\r' as an end-of-line, so a file with
CR-only line endings (or a stray '\r') silently loaded only its first
record.  Only end a line at a '\r' followed by '\n' or EOF; otherwise
let strtol() report the malformed index.

Add a regression test for a CR-only file.
@yoch
yoch merged commit 03f67f4 into master Oct 20, 2026
9 checks passed
@yoch
yoch deleted the fix/crlf-strict branch October 20, 2026 06:11
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