Skip to content

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

Open
serhiy-storchaka wants to merge 1 commit into
python:3.11from
serhiy-storchaka:backport-153030-3.11
Open

[3.11] gh-153030: Fix quadratic complexity in incremental parsing in HTMLParser (GH-153031)#153042
serhiy-storchaka wants to merge 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant