]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix an index and clean up comments.
authorEzio Melotti <ezio.melotti@gmail.com>
Mon, 13 Feb 2012 18:20:00 +0000 (20:20 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Mon, 13 Feb 2012 18:20:00 +0000 (20:20 +0200)
Lib/html/parser.py
Lib/test/test_htmlparser.py

index 9db8ab582bec32d58d0dc54c189f44c1992b3f3c..aa31fbc5b1bdbf6d96c4b5cc8d1cd42275da8c05 100644 (file)
@@ -270,12 +270,13 @@ class HTMLParser(_markupbase.ParserBase):
         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])
index 1da2ce4f9b73f616fa371d34560dd77a2dca3881..e2b09a96c0399912dd55a984e84caea97ba60a51 100644 (file)
@@ -393,7 +393,6 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
         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"')])