Message378359
When the `close` method of the HtmlParser is called, any cached text data is generally flushed and passed to a `data` event; except when in `data_mode`. Specifically, if an unclosed `script` or `style` tag has been encountered, a call to `close` does not flush the data.
A simple test which demonstrates the issue is attached.
I see that in Lib/html/parser.py#L244-L249 there are two nested if statements which both check for `not self.cdata_elem`. Obviously, if we got past the first one, that situation will never exist for the nested one. Somehow this block of code needs a branch for when `self.cdata_elem` is True.
I should note that the input is invalid HTML. However, the existing behavior results in data loss. Within any other unclosed tag (other than `script` or `style`) any data is still flushed and passed to a `data` event. I would expect the same behavior here. Although, the data escaping behavior should perhaps be applied as it is with data within properly closed tags. |
|
Date |
User |
Action |
Args |
2020-10-10 01:08:29 | waylan | set | recipients:
+ waylan |
2020-10-10 01:08:29 | waylan | set | messageid: <1602292109.75.0.598084394689.issue41989@roundup.psfhosted.org> |
2020-10-10 01:08:29 | waylan | link | issue41989 messages |
2020-10-10 01:08:29 | waylan | create | |
|