From 12873222c379543552931abc1df0531aa1d4a055 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Fri, 25 Apr 2025 16:31:38 -0400 Subject: [PATCH] Simplify HTMLParser by removing unnecessary assignment and assertion --- Lib/html/parser.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Lib/html/parser.py b/Lib/html/parser.py index 13c95c34e505c8..30437d42769248 100644 --- a/Lib/html/parser.py +++ b/Lib/html/parser.py @@ -226,9 +226,6 @@ def goahead(self, end): if match: # match.group() will contain at least 2 chars if end and match.group() == rawdata[i:]: - k = match.end() - if k <= i: - k = n i = self.updatepos(i, i + 1) # incomplete break @@ -243,7 +240,7 @@ def goahead(self, end): assert 0, "interesting.search() lied" # end while if end and i < n and not self.cdata_elem: - if self.convert_charrefs and not self.cdata_elem: + if self.convert_charrefs: self.handle_data(unescape(rawdata[i:n])) else: self.handle_data(rawdata[i:n])