-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Closed as not planned
Closed as not planned
Copy link
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The html.parser.HTMLParser method check_for_whole_start_tag crashes with an AssertionError when its rawdata is an empty string.
from html.parser import HTMLParser
parser = HTMLParser()
parser.feed('')
result = parser.check_for_whole_start_tag(0)Traceback (most recent call last):
File "/data/src/test.py", line 11, in <module>
result = parser.check_for_whole_start_tag(0)
File "/home/hdd/miniconda3/lib/python3.13/html/parser.py", line 394, in check_for_whole_start_tag
raise AssertionError("we should not get here!")
AssertionError: we should not get here!I think the internal code should gracefully handle this None match by returning -1 instead if an AssertionError?
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error