Skip to content

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

Merged
pablogsal merged 1 commit into
python:3.11from
serhiy-storchaka:backport-153030-3.11
Aug 10, 2026
Merged

pablogsal merged 1 commit into
python:3.11from
serhiy-storchaka:backport-153030-3.11

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Manual backport of GH-153031 to 3.11.

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.

…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.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit bcf98dd)
@pablogsal
pablogsal merged commit c2390b9 into python:3.11 Aug 10, 2026
29 of 33 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the backport-153030-3.11 branch August 27, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants