Opened 6 months ago

Closed 5 months ago

Last modified 11 days ago

#36499 closed Cleanup/optimization (fixed)

strip_tags() and test_parsing_errors() fails with patched Python versions due to HTMLParser EOF behavior change

Reported by: MeggyCal Owned by: Natalia Bidart
Component: Utilities Version: 5.2
Severity: Normal Keywords:
Cc: Clifford Gama Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi, I am a packager in (open)SUSE. My colleague patched our python interpreters with their respective fixes for https://github.com/python/cpython/issues/135462 and test_strip_tags started failing with these (see bellow). As per https://github.com/python/cpython/pull/135464#discussion_r2145171001 they introduced a change in behaviour with the fix and documented it. My understanding is that tags are now left alone if they are invalid.

There is no new CPython release yet, so nothing is set in stone and I understand you might have dificulties reproducing and addressing this issue preliminary, but I just wanted to let you know.

Failure:

[  661s] ======================================================================
[  661s] FAIL: test_strip_tags (utils_tests.test_html.TestUtilsHtml.test_strip_tags) [<object object at 0xed890348>] (value='><!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&[CUT MANY &]
[CUT MANY &]

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&D', output='><!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
[CUT MANY &]
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&D')
[  661s] ----------------------------------------------------------------------
[  661s] Traceback (most recent call last):
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 58, in testPartExecutor
[  661s]     yield
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 556, in subTest
[  661s]     yield
[  661s]   File "/home/abuild/rpmbuild/BUILD/python-Django-5.2.2-build/django-5.2.2/tests/utils_tests/test_html.py", line 156, in test_strip_tags
[  661s]     self.check_output(strip_tags, value, output)
[  661s]     ^^^^^^^
[  661s]   File "/home/abuild/rpmbuild/BUILD/python-Django-5.2.2-build/django-5.2.2/tests/utils_tests/test_html.py", line 34, in check_output
[  661s]     self.assertEqual(function(value), output)
[  661s]     ^^^^^^^^^^^^^^^
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 907, in assertEqual
[  661s]     assertion_func(first, second, msg=msg)
[  661s]     ^^^^^^^^^^^^^^^
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 1273, in assertMultiLineEqual
[  661s]     self.fail(self._formatMessage(msg, standardMsg))
[  661s]     ^^^^^^^^^^^
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 732, in fail
[  661s]     raise self.failureException(msg)
[  661s]     ^^^^^^^^^^^^^^^
[  661s] AssertionError: '>' != '><!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&[15958 chars]&&&D'
[  661s] Diff is 16012 characters long. Set self.maxDiff to None to see it.
[  661s] 
[  661s] ======================================================================
[  661s] FAIL: test_strip_tags (utils_tests.test_html.TestUtilsHtml.test_strip_tags) [<object object at 0xed890348>] (value='><a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a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<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<aa')
[  661s] ----------------------------------------------------------------------
[  661s] Traceback (most recent call last):
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 58, in testPartExecutor
[  661s]     yield
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 556, in subTest
[  661s]     yield
[  661s]   File "/home/abuild/rpmbuild/BUILD/python-Django-5.2.2-build/django-5.2.2/tests/utils_tests/test_html.py", line 156, in test_strip_tags
[  661s]     self.check_output(strip_tags, value, output)
[  661s]     ^^^^^^^
[  661s]   File "/home/abuild/rpmbuild/BUILD/python-Django-5.2.2-build/django-5.2.2/tests/utils_tests/test_html.py", line 34, in check_output
[  661s]     self.assertEqual(function(value), output)
[  661s]     ^^^^^^^^^^^^^^^
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 907, in assertEqual
[  661s]     assertion_func(first, second, msg=msg)
[  661s]     ^^^^^^^^^^^^^^^
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 1273, in assertMultiLineEqual
[  661s]     self.fail(self._formatMessage(msg, standardMsg))
[  661s]     ^^^^^^^^^^^
[  661s]   File "/usr/lib/python3.13/unittest/case.py", line 732, in fail
[  661s]     raise self.failureException(msg)
[  661s]     ^^^^^^^^^^^^^^^
[  661s] AssertionError: '>' != '><a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<[956 chars]a<aa'
[  661s] Diff is 1010 characters long. Set self.maxDiff to None to see it.
[  661s] 
[  661s] ----------------------------------------------------------------------
[  661s] Ran 17447 tests in 178.560s

Change History (22)

comment:1 by MeggyCal, 6 months ago

Sorry, as I look at the test data alone, something ate almost all the >s, which doesn't look intentional. I have to check the patches... Edit: at a glance our patches do not differ from the upstream ones.

Last edited 6 months ago by MeggyCal (previous) (diff)

comment:2 by Clifford Gama, 6 months ago

Cc: Clifford Gama added
Component: UncategorizedUtilities
Summary: CPython might have introduced a change of behaviour in their fix for https://github.com/python/cpython/issues/135462strip_tags() fails with patched Python versions due to HTMLParser EOF behavior change
Triage Stage: UnreviewedAccepted

Thanks for the report! I managed to reproduce on against the main python e18829a8 branch. Since the commit (gh-135462) was backported to Python versions currently supported by Django, I think we can accept this on the basis that Django needs to make a decision.

The issue is that an unterminated tag is now being discarded. In the case of the failing tests these are "<a<a..." and "<&&&...&D" and the first "<sc" in "<sc<!-- -->ript>test<<!-- -->/script>".

I see two ways we may handle this:

  1. Adjust strip_tags() to preserve pre-3.13 behavior, ensuring consistency, or
  2. Update tests, and possibly note the behavioral shift in docs, although the latter may not be necessary as the changed behaviour was not documented.

(FWIW, the associated issue that introduced the commit in Python was marked is a security issue.)

Last edited 6 months ago by Clifford Gama (previous) (diff)

comment:3 by Natalia Bidart, 6 months ago

Owner: set to Natalia Bidart
Severity: NormalRelease blocker
Status: newassigned

We are also seeing the failures in our scheduled tests CI but only when using Python 3.14 (example). I have also reproduced locally with Python 3.14 beta 4.

The changes in Python were driven by a security report started by the Django Security Team, following up some private reports we got. I think we need to update the tests and stick as much as possible to the Python's HTMLParser behavior. Also, we need to backport this to the supported stable branches, so I'll mark it as release blocker.

comment:4 by Natalia Bidart, 6 months ago

Has patch: set
Needs documentation: set

comment:5 by Natalia Bidart, 6 months ago

Needs documentation: unset
Patch needs improvement: set
Severity: Release blockerNormal
Type: BugCleanup/optimization

I've discussed this issue with Sarah and she made the valid point that since this affects tests only, it shouldn't require release notes nor the "Release Blocker" status. Updating!

Setting as "patch needs improvement" to block the PR until the Python versions are released.

comment:6 by Sarah Boyce, 6 months ago

Summary: strip_tags() fails with patched Python versions due to HTMLParser EOF behavior changestrip_tags() and test_parsing_errors() fails with patched Python versions due to HTMLParser EOF behavior change

comment:7 by Michał Górny, 5 months ago

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).

in reply to:  7 comment:8 by Natalia Bidart, 5 months ago

Replying to 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.

comment:9 by Natalia Bidart, 5 months ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

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.

comment:10 by nessita <124304+nessita@…>, 5 months ago

Resolution: fixed
Status: assignedclosed

In 29806275:

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.

comment:11 by nessita <124304+nessita@…>, 5 months ago

In 74fafe2:

[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.

comment:12 by nessita <124304+nessita@…>, 5 months ago

In 9a720d5c:

[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.

comment:13 by nessita <124304+nessita@…>, 5 months ago

In 19e7b95:

[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.

comment:14 by nessita <124304+nessita@…>, 5 months ago

In 0980178:

[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.

comment:15 by nessita <124304+nessita@…>, 5 months ago

In 2a79837:

[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.

comment:16 by nessita <124304+nessita@…>, 5 months ago

In c3f98718:

[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.

comment:17 by GitHub <noreply@…>, 3 months ago

In 185b049e:

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.

comment:18 by Jacob Walls <jacobtylerwalls@…>, 4 weeks ago

In 7b80b218:

Refs #36499 -- Adjusted test_strip_tags following Python behavior change for incomplete entities.

comment:19 by Jacob Walls <jacobtylerwalls@…>, 4 weeks ago

In e5064f5:

[6.0.x] Refs #36499 -- Adjusted test_strip_tags following Python behavior change for incomplete entities.

Backport of 7b80b2186300620931009fd62c2969f108fe7a62 from main.

comment:20 by Jacob Walls <jacobtylerwalls@…>, 4 weeks ago

In 5ca0f622:

[5.2.x] Refs #36499 -- Adjusted test_strip_tags following Python behavior change for incomplete entities.

Backport of 7b80b2186300620931009fd62c2969f108fe7a62 from main.

comment:21 by Mike Dearman, 11 days ago

Just a heads up. I ran the Django test suite locally in my Ubuntu 24.04 Python 3.12.3 environment (sys.version showing as '3.12.3 (main, Nov 6 2025, 13:44:16) [GCC 13.3.0]') against the main Django branch (d6ae2ed868e43671afc4d433c3d8f4d27f7eb555).

I am seeing two subtest failures in the test_strip_tags test.

FAIL: test_strip_tags (utils_tests.test_html.TestUtilsHtml.test_strip_tags) [<object object at 0x75d20021d660>] (value='><!&&&&&&&&&&&&&&&&&&&&&&
...
======================================================================
FAIL: test_strip_tags (utils_tests.test_html.TestUtilsHtml.test_strip_tags) [<object object at 0x75d20021d660>] (value='><a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a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<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<a<aa')
----------------------------------------------------------------------

When I inspect my local /usr/lib/python3.12/html/parser.py it appears to contain the patch from https://github.com/python/cpython/pull/135483/files.
The test_strip_tests changes from above seems to only consider 3.12.12+ as having been patched based on the logic in https://github.com/django/django/commit/7b80b2186300620931009fd62c2969f108fe7a62#diff-8d44648c5c0191dee21c4d5034021573a885c878a9c50af658259c1747209f19R177

Based on https://launchpad.net/ubuntu/noble/+source/python3.12/+changelog it seems that the libpython3.12-stdlib apt package was patched, but Python still reports as 3.12.3, so the Django tests can't account for the patched HTMLParser.

So others may experience this "issue", but not sure Django tests can/should do anything different to account for it?

comment:22 by Jacob Walls, 11 days ago

Thanks for the info.

The version switches are left in for convenience for now, but we may remove all of them as soon as all CI runners are running fully patched Python versions, since Django doesn't officially support anything other than the latest point releases of Python. You will encounter other test failures (I think there is a recent mail-related ticket) if running earlier point releases.

Note: See TracTickets for help on using tickets.
Back to Top