diff Lib/HTMLParser.py @ 61885:ebda6803f8d5 legacy-trunk

Issue #6662: Fix parsing of malformatted charref (&#bad;)
author Victor Stinner <victor.stinner@haypocalc.com>
date Mon, 24 May 2010 21:33:24 +0000
parents 454d38c1f47e
children 05cccd4257a2
line wrap: on
line diff
--- a/Lib/HTMLParser.py	Mon May 24 21:29:07 2010 +0000
+++ b/Lib/HTMLParser.py	Mon May 24 21:33:24 2010 +0000
@@ -175,6 +175,9 @@
                     i = self.updatepos(i, k)
                     continue
                 else:
+                    if ";" in rawdata[i:]: #bail by consuming &#
+                        self.handle_data(rawdata[0:2])
+                        i = self.updatepos(i, 2)
                     break
             elif startswith('&', i):
                 match = entityref.match(rawdata, i)