Skip to content

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

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

serhiy-storchaka merged 1 commit into
python:3.13from
miss-islington:backport-bcf98dd-3.13

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 merged commit 7933f4b into python:3.13 Jul 4, 2026
37 of 40 checks passed
@miss-islington
miss-islington deleted the backport-bcf98dd-3.13 branch July 4, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants