HTMLParser chokes on bad end tag in comment

Rene Pijlman reply.in.the.newsgroup at my.address.is.invalid
Sun May 28 17:04:40 EDT 2006


The code below results in an exception (Python 2.4.2):

HTMLParser.HTMLParseError: bad end tag: "</foo' + 'bar>", at line 4,
column 6

Should it? The end tag it chokes on is in comment, isn't it?

import HTMLParser
HTMLParser.HTMLParser().feed("""
<html><head><title></title></head><body><script>
<!--
x = '</foo' + 'bar>'
// -->
</script></body></html>
""")

-- 
René Pijlman



More information about the Python-list mailing list