mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
#13987: HTMLParser is now able to handle EOFs in the middle of a construct.
This commit is contained in:
parent
fd7e4964bb
commit
d2307cb48a
3 changed files with 21 additions and 11 deletions
|
@ -170,9 +170,16 @@ class HTMLParser(markupbase.ParserBase):
|
|||
else:
|
||||
break
|
||||
if k < 0:
|
||||
if end:
|
||||
self.error("EOF in middle of construct")
|
||||
break
|
||||
if not end:
|
||||
break
|
||||
k = rawdata.find('>', i + 1)
|
||||
if k < 0:
|
||||
k = rawdata.find('<', i + 1)
|
||||
if k < 0:
|
||||
k = i + 1
|
||||
else:
|
||||
k += 1
|
||||
self.handle_data(rawdata[i:k])
|
||||
i = self.updatepos(i, k)
|
||||
elif startswith("&#", i):
|
||||
match = charref.match(rawdata, i)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue