Commit dde954e
committed
gh-109638: Fix excessive backtracking in csv.Sniffer doublequote detection
The doublequote-detection pattern used two greedy character classes that both
admitted the quote character, so the engine had to try every way of splitting a
run of quotes between them.
Excluding the quote from the first class forces the quote that follows it to
match at the first one available, which removes the ambiguity while leaving
detection intact. The second class must keep admitting the quote, since that
is what lets `"a""b"` match -- narrowing both classes, or making the first one
atomic while it still admits the quote, silently disables the detection.1 parent 23b2b40 commit dde954e
3 files changed
Lines changed: 17 additions & 1 deletion
File tree
- Lib
- test
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
333 | 339 | | |
334 | | - | |
| 340 | + | |
335 | 341 | | |
336 | 342 | | |
337 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1501 | 1501 | | |
1502 | 1502 | | |
1503 | 1503 | | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1504 | 1510 | | |
1505 | 1511 | | |
1506 | 1512 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments