[3.12] gh-135661: Fix CDATA section parsing in HTMLParser (GH-135665)#137774
Merged
Yhg1s merged 1 commit intopython:3.12python/cpython:3.12from Oct 6, 2025
serhiy-storchaka:backport-0cbbfc4-3.12serhiy-storchaka/cpython:backport-0cbbfc4-3.12Copy head branch name to clipboard
Merged
[3.12] gh-135661: Fix CDATA section parsing in HTMLParser (GH-135665)#137774Yhg1s merged 1 commit intopython:3.12python/cpython:3.12from serhiy-storchaka:backport-0cbbfc4-3.12serhiy-storchaka/cpython:backport-0cbbfc4-3.12Copy head branch name to clipboard
Yhg1s merged 1 commit intopython:3.12python/cpython:3.12from
serhiy-storchaka:backport-0cbbfc4-3.12serhiy-storchaka/cpython:backport-0cbbfc4-3.12Copy head branch name to clipboard
Conversation
Member
Author
|
Backports to 3.9-3.11 will be created from the 3.12 backport. |
Member
Author
|
This code slightly differs from |
ezio-melotti
approved these changes
Aug 14, 2025
…onGH-135665) "] ]>" and "]] >" no longer end the CDATA section. Make CDATA section parsing context depending. Add private method HTMLParser._set_support_cdata() to change the context. If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>". If called with False, "<[CDATA[" starts a bogus comments which ends with ">". (cherry picked from commit 0cbbfc4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
8bd8188 to
1904262
Compare
Member
Author
|
This includes also #137873. |
|
Thanks @serhiy-storchaka for the PR, and @Yhg1s for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10, 3.11. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Oct 6, 2025
…onGH-135665) (pythonGH-137774) "] ]>" and "]] >" no longer end the CDATA section. Make CDATA section parsing context depending. Add private method HTMLParser._set_support_cdata() to change the context. If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>". If called with False, "<[CDATA[" starts a bogus comments which ends with ">". (cherry picked from commit 0cbbfc4) (cherry picked from commit dcf2476) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Oct 6, 2025
…onGH-135665) (pythonGH-137774) "] ]>" and "]] >" no longer end the CDATA section. Make CDATA section parsing context depending. Add private method HTMLParser._set_support_cdata() to change the context. If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>". If called with False, "<[CDATA[" starts a bogus comments which ends with ">". (cherry picked from commit 0cbbfc4) (cherry picked from commit dcf2476) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-139659 is a backport of this pull request to the 3.11 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Oct 6, 2025
…onGH-135665) (pythonGH-137774) "] ]>" and "]] >" no longer end the CDATA section. Make CDATA section parsing context depending. Add private method HTMLParser._set_support_cdata() to change the context. If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>". If called with False, "<[CDATA[" starts a bogus comments which ends with ">". (cherry picked from commit 0cbbfc4) (cherry picked from commit dcf2476) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-139660 is a backport of this pull request to the 3.10 branch. |
|
GH-139661 is a backport of this pull request to the 3.9 branch. |
ambv
pushed a commit
that referenced
this pull request
Oct 7, 2025
…GH-137774) (GH-139659) "] ]>" and "]] >" no longer end the CDATA section. Make CDATA section parsing context depending. Add private method HTMLParser._set_support_cdata() to change the context. If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>". If called with False, "<[CDATA[" starts a bogus comments which ends with ">". (cherry picked from commit 0cbbfc4) (cherry picked from commit dcf2476) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ambv
pushed a commit
that referenced
this pull request
Oct 7, 2025
…GH-137774) (GH-139660) "] ]>" and "]] >" no longer end the CDATA section. Make CDATA section parsing context depending. Add private method HTMLParser._set_support_cdata() to change the context. If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>". If called with False, "<[CDATA[" starts a bogus comments which ends with ">". (cherry picked from commit 0cbbfc4) (cherry picked from commit dcf2476) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ambv
added a commit
that referenced
this pull request
Oct 7, 2025
…H-137774) (GH-139661) "] ]>" and "]] >" no longer end the CDATA section. Make CDATA section parsing context depending. Add private method HTMLParser._set_support_cdata() to change the context. If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>". If called with False, "<[CDATA[" starts a bogus comments which ends with ">". (cherry picked from commit 0cbbfc4) (cherry picked from commit dcf2476) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"] ]>" and "]] >" no longer end the CDATA section.
Make CDATA section parsing context depending.
Add private method HTMLParser._set_support_cdata() to change the context. If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>". If called with False, "<[CDATA[" starts a bogus comments which ends with ">".
(cherry picked from commit 0cbbfc4)