Skip to content

[3.14] gh-98820: Fix quadratic time in csv.Sniffer for quoted fields (GH-154867) - #155117

Open
miss-islington wants to merge 1 commit into
python:3.14from
miss-islington:backport-476fb09-3.14
Open

[3.14] gh-98820: Fix quadratic time in csv.Sniffer for quoted fields (GH-154867)#155117
miss-islington wants to merge 1 commit into
python:3.14from
miss-islington:backport-476fb09-3.14

Conversation

@miss-islington

@miss-islington miss-islington commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The regular expressions which look for a quoted field matched its body
lazily, so a closing quote which was not followed by a delimiter was
retried with every following quote, to the end of the sample. Match
the body possessively instead: it ends at the first quote which is not
doubled, as it does for a reader.
(cherry picked from commit 476fb09)

Co-authored-by: Serhiy Storchaka [email protected]
Co-authored-by: Claude Opus 5 (1M context) [email protected]

…ields (pythonGH-154867)

The regular expressions which look for a quoted field matched its body
lazily, so a closing quote which was not followed by a delimiter was
retried with every following quote, to the end of the sample.  Match
the body possessively instead: it ends at the first quote which is not
doubled, as it does for a reader.
(cherry picked from commit 476fb09)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants