diff --git a/Lib/html/parser.py b/Lib/html/parser.py index 75bf8adae6d..5d7050dad23 100644 --- a/Lib/html/parser.py +++ b/Lib/html/parser.py @@ -271,11 +271,8 @@ class HTMLParser(_markupbase.ParserBase): j -= len(suffix) break self.handle_comment(rawdata[i+4:j]) - elif startswith("', i+9) - if j < 0: - return -1 - self.unknown_decl(rawdata[i+3: j]) - return j + 3 - else: - return self.parse_bogus_comment(i) + elif rawdata[i:i+9] == '', i+9) + if j < 0: + return -1 + self.unknown_decl(rawdata[i+3: j]) + return j + 3 elif rawdata[i:i+9].lower() == ' gtpos = rawdata.find('>', i+9) diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index fff41dab321..6a1d69335a0 100644 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -791,7 +791,7 @@ text self._run_check('