Mercurial > cpython-lru_cache-weakref
diff Lib/HTMLParser.py @ 74915:4743a3a1e669 2.7
Fix an index, add more tests, avoid raising errors for unknown declarations, and clean up comments.
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Mon, 13 Feb 2012 20:36:55 +0200 |
| parents | a349448474ea |
| children | 11a31eb5da93 |
line wrap: on
line diff
--- a/Lib/HTMLParser.py Mon Feb 13 23:17:45 2012 +0800 +++ b/Lib/HTMLParser.py Mon Feb 13 20:36:55 2012 +0200 @@ -229,12 +229,13 @@ if rawdata[i:i+2] != '<!': self.error('unexpected call to parse_html_declaration()') if rawdata[i:i+4] == '<!--': + # this case is actually already handled in goahead() return self.parse_comment(i) elif rawdata[i:i+3] == '<![': return self.parse_marked_section(i) elif rawdata[i:i+9].lower() == '<!doctype': # find the closing > - gtpos = rawdata.find('>', 9) + gtpos = rawdata.find('>', i+9) if gtpos == -1: return -1 self.handle_decl(rawdata[i+2:gtpos]) @@ -427,7 +428,7 @@ pass def unknown_decl(self, data): - self.error("unknown declaration: %r" % (data,)) + pass # Internal -- helper to remove special character quoting entitydefs = None
