Skip to content

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

Merged
serhiy-storchaka merged 1 commit into
python:3.14from
miss-islington:backport-476fb09-3.14
Aug 4, 2026
Merged

[3.14] gh-98820: Fix quadratic time in csv.Sniffer for quoted fields (GH-154867)#155117
serhiy-storchaka merged 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 storchaka@gmail.com
Co-authored-by: Claude Opus 5 (1M context) noreply@anthropic.com

…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 <storchaka@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bedevere-app bedevere-app Bot added the type-security A security issue label Aug 3, 2026
@serhiy-storchaka
serhiy-storchaka merged commit 89f29c7 into python:3.14 Aug 4, 2026
52 of 55 checks passed
@miss-islington
miss-islington deleted the backport-476fb09-3.14 branch August 4, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-security A security issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants