]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-153030: Fix quadratic complexity in incremental parsing in HTMLParser ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 4 Jul 2026 18:08:05 +0000 (20:08 +0200)
committerGitHub <noreply@github.com>
Sat, 4 Jul 2026 18:08:05 +0000 (18:08 +0000)
commit07efb08123ba9367a7107325adb9d5626dca1ca9
tree5980c8a4235bfd6f91ddbc5b6e83ff378fb54e55
parentdfd2acb00937f0449270abf50c71e1e95251650c
[3.14] gh-153030: Fix quadratic complexity in incremental parsing in HTMLParser (GH-153031) (GH-153039)

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 bcf98ddbc40ec9b3ee87da0124a5660b19b7e606)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Lib/html/parser.py
Lib/test/test_htmlparser.py
Misc/NEWS.d/next/Security/2026-07-04-17-00-00.gh-issue-153030.RovkP6.rst [new file with mode: 0644]