| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
It is guessed by a majority vote among the line endings of the sample, instead of always being '\r\n'.
Documentation build overview3 files changed ± library/csv.html ± whatsnew/3.16.html ± whatsnew/changelog.html |
Sorry, something went wrong.
…honGH-155061) It is guessed by a majority vote among the line endings of the sample, instead of always being '\r\n'.
| Back | FazBrowse Home | New Git URL |
csv.Sniffer.sniff() always returned lineterminator='\r\n'. It is now guessed by a majority vote among the line endings of the sample, which the line splitter already preserves. A tie is broken in the order '\r\n', '\n', '\r', so a sample without a complete line still gives '\r\n'.
A line break inside a quoted field is counted too, because the vote is taken over the raw lines of the sample. It only wins if such breaks outnumber the real ones. Excluding them is possible on top of this (record which lines the reader pulls for each row), but it is not needed for the majority vote.
This only affects the writer: the reader recognizes '\r' and '\n' as end-of-line and ignores lineterminator.
PR #18336 addresses the same issue against the old sniffer, which was replaced by trial parsing in gh-83273.