[Python-checkins] bpo-45421: Remove dead code from html.parser (GH-28847)

Mariatta webhook-mailer at python.org
Tue Oct 12 13:12:27 EDT 2021


https://github.com/python/cpython/commit/562c0d7398b9f34ff63a1dc77113dad96a93ce4e
commit: 562c0d7398b9f34ff63a1dc77113dad96a93ce4e
branch: main
author: Alberto Mardegan <mardy at users.sourceforge.net>
committer: Mariatta <Mariatta at users.noreply.github.com>
date: 2021-10-12T10:12:21-07:00
summary:

bpo-45421: Remove dead code from html.parser (GH-28847)

Support for HtmlParserError was removed back in 2014 with commit
73a4359eb0eb624c588c5d52083ea4944f9787ea, however this small block was
missed.

files:
M Lib/html/parser.py

diff --git a/Lib/html/parser.py b/Lib/html/parser.py
index 58f6bb3b1e932..bef0f4fe4bf77 100644
--- a/Lib/html/parser.py
+++ b/Lib/html/parser.py
@@ -328,13 +328,6 @@ def parse_starttag(self, i):
 
         end = rawdata[k:endpos].strip()
         if end not in (">", "/>"):
-            lineno, offset = self.getpos()
-            if "\n" in self.__starttag_text:
-                lineno = lineno + self.__starttag_text.count("\n")
-                offset = len(self.__starttag_text) \
-                         - self.__starttag_text.rfind("\n")
-            else:
-                offset = offset + len(self.__starttag_text)
             self.handle_data(rawdata[i:endpos])
             return endpos
         if end.endswith('/>'):



More information about the Python-checkins mailing list