Skip to content

[3.15] gh-153030: Fix quadratic complexity in incremental parsing in HTMLParser (GH-153031)#153038

Merged
serhiy-storchaka merged 1 commit into
python:3.15from
miss-islington:backport-bcf98dd-3.15
Jul 5, 2026
Merged

[3.15] gh-153030: Fix quadratic complexity in incremental parsing in HTMLParser (GH-153031)#153038
serhiy-storchaka merged 1 commit into
python:3.15from
miss-islington:backport-bcf98dd-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

When an unterminated construct (e.g. a tag or comment) spanned many
feed() calls, rescanning the growing buffer and concatenating new data
onto it were both quadratic. New data is now accumulated in a list and
only joined and parsed once enough has piled up.
(cherry picked from commit bcf98dd)

Co-authored-by: Serhiy Storchaka storchaka@gmail.com
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

…TMLParser (pythonGH-153031)

When an unterminated construct (e.g. a tag or comment) spanned many
feed() calls, rescanning the growing buffer and concatenating new data
onto it were both quadratic.  New data is now accumulated in a list and
only joined and parsed once enough has piled up.
(cherry picked from commit bcf98dd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) July 4, 2026 17:41
@serhiy-storchaka serhiy-storchaka merged commit e9f92ac into python:3.15 Jul 5, 2026
103 of 105 checks passed
@miss-islington miss-islington deleted the backport-bcf98dd-3.15 branch July 5, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants