Issue 736659: markupbase parse_declaration cannot recognize comments (original) (raw)
In markupbase class parser method parse_declaration
It verfies that the first two characters are "<!"
Then it returns -1 if the next character is "-".
After that, it checks to see if the next two characters are "--", but if they were, it would already have returned.
Solution: Check for comments before checking for a short buffer.
if rawdata[j:j+1] == '--': #comment
# Locate --.*-- as the body of the comment
return self.parse_comment(i)
if rawdata[j:j+1] in ("-", ""):
# Start of comment followed by buffer
# boundary, or just a buffer boundary.
return -1