]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-153030: Fix quadratic complexity in incremental parsing in HTMLParser (GH-153031)
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 4 Jul 2026 17:40:22 +0000 (20:40 +0300)
committerGitHub <noreply@github.com>
Sat, 4 Jul 2026 17:40:22 +0000 (20:40 +0300)
commitbcf98ddbc40ec9b3ee87da0124a5660b19b7e606
treec50f7d5c24217ae89e5591cd5a0f127b0423453c
parent66c76fa6737d497cd3c735f75e67a5ca52eceb15
gh-153030: Fix quadratic complexity in incremental parsing in HTMLParser (GH-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>
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]