Bug 2368745 - python-beautifulsoup4 fails to build with Python 3.14: 3 tests Failed: DID NOT RAISE <class 'bs4.exceptions.ParserRejectedMarkup'>
Summary: python-beautifulsoup4 fails to build with Python 3.14: 3 tests Failed: DID NO...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-beautifulsoup4
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Terje Rosten
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-05-27 12:56 UTC by Miro Hrončok
Modified: 2025-05-29 09:25 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-05-29 09:25:46 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-beautifulsoup4 pull-request 15 0 None None None 2025-05-28 07:47:08 UTC

Description Miro Hrončok 2025-05-27 12:56:20 UTC
python-beautifulsoup4 fails to build with Python 3.14.0b2.


=================================== FAILURES ===================================
_ TestFuzz.test_rejected_markup[clusterfuzz-testcase-minimized-bs4_fuzzer-5703933063462912] _

self = <bs4.tests.test_fuzz.TestFuzz object at 0x7f9038e14b90>
filename = 'clusterfuzz-testcase-minimized-bs4_fuzzer-5703933063462912'

    @pytest.mark.parametrize(
        "filename",
        [
            "clusterfuzz-testcase-minimized-bs4_fuzzer-5703933063462912",
            "crash-ffbdfa8a2b26f13537b68d3794b0478a4090ee4a",
        ],
    )
    def test_rejected_markup(self, filename):
        markup = self.__markup(filename)
>       with pytest.raises(ParserRejectedMarkup):
E       Failed: DID NOT RAISE <class 'bs4.exceptions.ParserRejectedMarkup'>

bs4/tests/test_fuzz.py:81: Failed
_ TestFuzz.test_rejected_markup[crash-ffbdfa8a2b26f13537b68d3794b0478a4090ee4a] _

self = <bs4.tests.test_fuzz.TestFuzz object at 0x7f9038e14cd0>
filename = 'crash-ffbdfa8a2b26f13537b68d3794b0478a4090ee4a'

    @pytest.mark.parametrize(
        "filename",
        [
            "clusterfuzz-testcase-minimized-bs4_fuzzer-5703933063462912",
            "crash-ffbdfa8a2b26f13537b68d3794b0478a4090ee4a",
        ],
    )
    def test_rejected_markup(self, filename):
        markup = self.__markup(filename)
>       with pytest.raises(ParserRejectedMarkup):
E       Failed: DID NOT RAISE <class 'bs4.exceptions.ParserRejectedMarkup'>

bs4/tests/test_fuzz.py:81: Failed
------------------------------ Captured log call -------------------------------
WARNING  bs4.dammit:dammit.py:825 Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.
________________ TestHTMLParserTreeBuilder.test_rejected_input _________________

self = <bs4.tests.test_htmlparser.TestHTMLParserTreeBuilder object at 0x7f9038e151d0>

    def test_rejected_input(self):
        # Python's html.parser will occasionally reject markup,
        # especially when there is a problem with the initial DOCTYPE
        # declaration. Different versions of Python sound the alarm in
        # different ways, but Beautiful Soup consistently raises
        # errors as ParserRejectedMarkup exceptions.
        bad_markup = [
            # https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28873
            # https://github.com/guidovranken/python-library-fuzzers/blob/master/corp-html/519e5b4269a01185a0d5e76295251921da2f0700
            # https://github.com/python/cpython/issues/81928
            b"\n<![\xff\xfe\xfe\xcd\x00",
            # https://github.com/guidovranken/python-library-fuzzers/blob/master/corp-html/de32aa55785be29bbc72a1a8e06b00611fb3d9f8
            # https://github.com/python/cpython/issues/78661
            #
            b"<![n\x00",
            b"<![UNKNOWN[]]>",
        ]
        for markup in bad_markup:
>           with pytest.raises(ParserRejectedMarkup):
E           Failed: DID NOT RAISE <class 'bs4.exceptions.ParserRejectedMarkup'>

bs4/tests/test_htmlparser.py:37: Failed
=========================== short test summary info ============================
FAILED bs4/tests/test_fuzz.py::TestFuzz::test_rejected_markup[clusterfuzz-testcase-minimized-bs4_fuzzer-5703933063462912]
FAILED bs4/tests/test_fuzz.py::TestFuzz::test_rejected_markup[crash-ffbdfa8a2b26f13537b68d3794b0478a4090ee4a]
FAILED bs4/tests/test_htmlparser.py::TestHTMLParserTreeBuilder::test_rejected_input
=================== 3 failed, 841 passed, 7 skipped in 1.49s ===================

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/09092271-python-beautifulsoup4/

For all our attempts to build python-beautifulsoup4 with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-beautifulsoup4/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 2 Terje Rosten 2025-05-29 09:25:46 UTC
PR merged


Note You need to log in before you can comment on or make changes to this bug.