Re: [Django] #36499: strip_tags() and test_parsing_errors() fails with patched Python versions due to HTMLParser EOF behavior change

15 views
Skip to first unread message

Django

unread,
Aug 7, 2025, 8:19:12 AMAug 7
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: assigned
Component: Utilities | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Michał Górny):

This is now released in CPython 3.13.6, and it has been backported back as
far as to 3.9 (not released upstream yet, but at least some distributions
have already backported it).
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 7, 2025, 8:35:07 AMAug 7
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: assigned
Component: Utilities | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):

Replying to [comment:7 Michał Górny]:
> This is now released in CPython 3.13.6, and it has been backported back
as far as to 3.9 (not released upstream yet, but at least some
distributions have already backported it).

Thank you Michał! We are tracking Python releases and as soon as every
version is released upstream (3.13.6, 3.12.12, 3.11.14, 3.10.19 and
3.9.24), we'll update our CI workers and land my PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:8>

Django

unread,
Aug 12, 2025, 10:03:42 PMAug 12
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: assigned
Component: Utilities | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

Comment:

Code has been adjusted to work with versions of Python with and without
the fix. I'll set a reminder to clean the code up once all the Pythons are
released and available in out CI/CD.
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:9>

Django

unread,
Aug 12, 2025, 10:04:20 PMAug 12
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: Utilities | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nessita <124304+nessita@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"2980627502c84a9fd09272e1349dc574a2ff1fb1" 29806275]:
{{{#!CommitTicketReference repository=""
revision="2980627502c84a9fd09272e1349dc574a2ff1fb1"
Fixed #36499 -- Adjusted
utils_tests.test_html.TestUtilsHtml.test_strip_tags following Python's
HTMLParser new behavior.

Python fixed a quadratic complexity processing for HTMLParser in:
https://github.com/python/cpython/commit/6eb6c5db.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:10>

Django

unread,
Aug 13, 2025, 4:48:48 PMAug 13
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: Utilities | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"74fafe2715fa2569a1682defcedc12a2e03b13d1" 74fafe2]:
{{{#!CommitTicketReference repository=""
revision="74fafe2715fa2569a1682defcedc12a2e03b13d1"
[5.2.x] Fixed test_utils.tests.HTMLEqualTests.test_parsing_errors
following Python's HTMLParser fixed parsing.

Further details about Python changes can be found in:
https://github.com/python/cpython/commit/0243f97cbadec8d985e63b1daec5d1cbc850cae3.

Refs #36499. Thank you Clifford Gama for the thorough review!

Backport of e4515dad7a6d953c0bd2414127ba36e1446ff41a from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:11>

Django

unread,
Aug 13, 2025, 4:48:48 PMAug 13
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: Utilities | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"9a720d5c5000b4fe0e75cdb87271065b5e80dedc" 9a720d5c]:
{{{#!CommitTicketReference repository=""
revision="9a720d5c5000b4fe0e75cdb87271065b5e80dedc"
[5.2.x] Fixed #36499 -- Adjusted
utils_tests.test_html.TestUtilsHtml.test_strip_tags following Python's
HTMLParser new behavior.

Python fixed a quadratic complexity processing for HTMLParser in:
https://github.com/python/cpython/commit/6eb6c5db.

Backport of 2980627502c84a9fd09272e1349dc574a2ff1fb1 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:12>

Django

unread,
Aug 13, 2025, 4:49:15 PMAug 13
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: Utilities | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"19e7b955520bfa78826c8e6c40b1756a39ba04b7" 19e7b95]:
{{{#!CommitTicketReference repository=""
revision="19e7b955520bfa78826c8e6c40b1756a39ba04b7"
[5.1.x] Fixed test_utils.tests.HTMLEqualTests.test_parsing_errors
following Python's HTMLParser fixed parsing.

Further details about Python changes can be found in:
https://github.com/python/cpython/commit/0243f97cbadec8d985e63b1daec5d1cbc850cae3.

Refs #36499. Thank you Clifford Gama for the thorough review!

Backport of e4515dad7a6d953c0bd2414127ba36e1446ff41a from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:13>

Django

unread,
Aug 13, 2025, 4:49:15 PMAug 13
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: Utilities | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"09801786df0f413e990a378f4603c8aeb16968cc" 0980178]:
{{{#!CommitTicketReference repository=""
revision="09801786df0f413e990a378f4603c8aeb16968cc"
[5.1.x] Fixed #36499 -- Adjusted
utils_tests.test_html.TestUtilsHtml.test_strip_tags following Python's
HTMLParser new behavior.

Python fixed a quadratic complexity processing for HTMLParser in:
https://github.com/python/cpython/commit/6eb6c5db.

Backport of 2980627502c84a9fd09272e1349dc574a2ff1fb1 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:14>

Django

unread,
Aug 13, 2025, 4:50:03 PMAug 13
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: Utilities | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"2a79837e19d2569c3e5162f3e0181a4e29bb7dba" 2a79837]:
{{{#!CommitTicketReference repository=""
revision="2a79837e19d2569c3e5162f3e0181a4e29bb7dba"
[4.2.x] Fixed test_utils.tests.HTMLEqualTests.test_parsing_errors
following Python's HTMLParser fixed parsing.

Further details about Python changes can be found in:
https://github.com/python/cpython/commit/0243f97cbadec8d985e63b1daec5d1cbc850cae3.

Refs #36499. Thank you Clifford Gama for the thorough review!

Backport of e4515dad7a6d953c0bd2414127ba36e1446ff41a from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:15>

Django

unread,
Aug 13, 2025, 4:50:03 PMAug 13
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: Utilities | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"c3f98718976820da5123169027612324d09a89d6" c3f98718]:
{{{#!CommitTicketReference repository=""
revision="c3f98718976820da5123169027612324d09a89d6"
[4.2.x] Fixed #36499 -- Adjusted
utils_tests.test_html.TestUtilsHtml.test_strip_tags following Python's
HTMLParser new behavior.

Python fixed a quadratic complexity processing for HTMLParser in:
https://github.com/python/cpython/commit/6eb6c5db.

Backport of 2980627502c84a9fd09272e1349dc574a2ff1fb1 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:16>

Django

unread,
Oct 22, 2025, 4:04:51 AM (yesterday) Oct 22
to django-...@googlegroups.com
#36499: strip_tags() and test_parsing_errors() fails with patched Python versions
due to HTMLParser EOF behavior change
-------------------------------------+-------------------------------------
Reporter: MeggyCal | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: Utilities | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by GitHub <noreply@…>):

In [changeset:"185b049e9e72a5ff4b07e33605e10eb4f52ca74c" 185b049e]:
{{{#!CommitTicketReference repository=""
revision="185b049e9e72a5ff4b07e33605e10eb4f52ca74c"
Refs #36499 -- Made TestUtilsHtml.test_strip_tags() assume behavior change
in X.Y.0 version for Python 3.14+.

This also removes unsupported versions of Python from the test dict.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36499#comment:17>
Reply all
Reply to author
Forward
0 new messages