aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/html/parser.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2025-05-10 13:36:06 -0400
committerGitHub <noreply@github.com>2025-05-10 17:36:06 +0000
commit53383e90e4df7029f792b7aa81aa2e4cff348ed0 (patch)
treed065c58c1e64620d25dea34de81649bfe7f0929d /Lib/html/parser.py
parent7dddb4e667b5eb76cbe11755051ec139b0f437a9 (diff)
downloadcpython-53383e90e4df7029f792b7aa81aa2e4cff348ed0.tar.gz
cpython-53383e90e4df7029f792b7aa81aa2e4cff348ed0.zip
gh-86155: Fix data loss after unclosed script or style tag in HTMLParser (GH-22658)
When calling .close() the HTMLParser should flush all remaining content, even when that content is in an unclosed script or style tag.
Diffstat (limited to 'Lib/html/parser.py')
-rw-r--r--Lib/html/parser.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/html/parser.py b/Lib/html/parser.py
index 1b8b6ea0e5a..1e30956fe24 100644
--- a/Lib/html/parser.py
+++ b/Lib/html/parser.py
@@ -260,7 +260,7 @@ class HTMLParser(_markupbase.ParserBase):
else:
assert 0, "interesting.search() lied"
# end while
- if end and i < n and not self.cdata_elem:
+ if end and i < n:
if self.convert_charrefs and not self.cdata_elem:
self.handle_data(unescape(rawdata[i:n]))
else: