GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — gh-157678: Allow csv.Sniffer to inspect large fields by GruffElixir · Pull Request #157689 · python/cpython Conversation
Contributor
csv.Sniffer.sniff() uses the CSV reader for trial parsing, so a sample containing a field larger than csv.field_size_limit() currently makes every candidate parse fail and raises csv.Error. Temporarily raising the parser limit to the sample length lets Sniffer determine the dialect, then restores the caller's configured limit in a finally block. Tests:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
Good catch. The limit is process-wide, so restoring it afterward still leaves a race. I removed the temporary mutation; trial parses now skip an over-limit row and continue, so the reported sample still infers , without changing the configured limit. Pushed 23cd0b0. The focused reproducer and syntax check pass locally; the full test_csv suite is left to CI. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
23cd0b0 to
b6006b7
Compare
|
Rechecked b6006b7. Sniffer no longer mutates the process-wide field_size_limit at all; oversized trial rows are skipped locally while later rows can still contribute to dialect inference. The regression also pins that the configured global limit remains unchanged, and the full CI matrix is green. My concurrency concern is resolved. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Please avoid using amend and force‑push . Follow the CPython community commit guidelines ,https://devguide.python.org/getting-started/pull-request-lifecycle/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.