diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-02-15 12:44:23 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-02-15 12:44:23 +0200 |
commit | d2307cb48ab09baa846947c5c2c4001dce9b6e52 (patch) | |
tree | 5667706edf910500c90d351f4114e2b97d1c76df /Lib/HTMLParser.py | |
parent | fd7e4964bbe8dcd750c46aa2a96aeaec97e7ef25 (diff) | |
download | cpython-git-d2307cb48ab09baa846947c5c2c4001dce9b6e52.tar.gz |
#13987: HTMLParser is now able to handle EOFs in the middle of a construct.
Diffstat (limited to 'Lib/HTMLParser.py')
-rw-r--r-- | Lib/HTMLParser.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/HTMLParser.py b/Lib/HTMLParser.py index f230c5f163..d2268d02cd 100644 --- a/Lib/HTMLParser.py +++ b/Lib/HTMLParser.py @@ -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) |