[Python-checkins] cpython (merge 3.2 -> default): Merge the indexfix and comments clean up.

ezio.melotti python-checkins at python.org
Mon Feb 13 19:29:06 CET 2012


http://hg.python.org/cpython/rev/80a50b7ad88f
changeset:   74914:80a50b7ad88f
parent:      74912:e1301a2e2316
parent:      74913:586d688dcf7f
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Mon Feb 13 20:28:46 2012 +0200
summary:
  Merge the indexfix  and comments clean up.

files:
  Lib/html/parser.py          |  3 ++-
  Lib/test/test_htmlparser.py |  1 -
  2 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Lib/html/parser.py b/Lib/html/parser.py
--- a/Lib/html/parser.py
+++ b/Lib/html/parser.py
@@ -270,12 +270,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])
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -393,7 +393,6 @@
         self._run_check("<!DOCTYPE foo $ >", [('decl', 'DOCTYPE foo $ ')])
 
     def test_illegal_declarations(self):
-        # XXX this might be wrong
         self._run_check('<!spacer type="block" height="25">',
                         [('comment', 'spacer type="block" height="25"')])
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list