Bug 2414796 - python-pysdl2 fails to build with Python 3.15: failing assertions in a few test_TTF_*
Summary: python-pysdl2 fails to build with Python 3.15: failing assertions in a few te...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pysdl2
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Sandro
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.15
TreeView+ depends on / blocked
 
Reported: 2025-11-13 10:15 UTC by Karolina Surma
Modified: 2025-11-16 09:13 UTC (History)
4 users (show)

Fixed In Version: python-pysdl2-0.9.17-8.fc44
Clone Of:
Environment:
Last Closed: 2025-11-16 09:13:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github py-sdl py-sdl2 issues 286 0 None open Test failures with freetype 2.14.0 2025-11-15 20:12:34 UTC

Description Karolina Surma 2025-11-13 10:15:27 UTC
python-pysdl2 fails to build with Python 3.15.0a1.

____________________________ test_TTF_GlyphMetrics _____________________________

with_sdl_ttf = None

    def test_TTF_GlyphMetrics(with_sdl_ttf):
        expected = {
            'A': [1, 25, 0, 29, 25],
            'j': [-3, 7, -9, 28, 9],
            '.': [2, 7, -1, 4, 8]
        }
        font = sdlttf.TTF_OpenFont(fontfile, 40)
        minX, maxX, minY, maxY = c_int(0), c_int(0), c_int(0), c_int(0)
        adv = c_int(0)
        for char in expected.keys():
            ret = sdlttf.TTF_GlyphMetrics(
                font, ord(char),
                byref(minX), byref(maxX), byref(minY), byref(maxY), byref(adv)
            )
            results = [x.value for x in (minX, maxX, minY, maxY, adv)]
            assert sdlttf.TTF_GetError() == b""
            assert ret == 0
>           assert results == expected[char]
E           assert [-3, 7, -9, 29, 9] == [-3, 7, -9, 28, 9]
E             
E             At index 3 diff: 29 != 28
E             Use -v to get more diff

sdl2/test/sdlttf_test.py:373: AssertionError
___________________________ test_TTF_GlyphMetrics32 ____________________________

with_sdl_ttf = None

    @pytest.mark.skipif(sdlttf.dll.version < 2018, reason="not available")
    def test_TTF_GlyphMetrics32(with_sdl_ttf):
        expected = {
            'A': [1, 25, 0, 29, 25],
            'j': [-3, 7, -9, 28, 9],
            '.': [2, 7, -1, 4, 8]
        }
        font = sdlttf.TTF_OpenFont(fontfile, 40)
        minX, maxX, minY, maxY = c_int(0), c_int(0), c_int(0), c_int(0)
        adv = c_int(0)
        for char in expected.keys():
            ret = sdlttf.TTF_GlyphMetrics32(
                font, ord(char),
                byref(minX), byref(maxX), byref(minY), byref(maxY), byref(adv)
            )
            results = [x.value for x in (minX, maxX, minY, maxY, adv)]
            assert sdlttf.TTF_GetError() == b""
            assert ret == 0
>           assert results == expected[char]
E           assert [-3, 7, -9, 29, 9] == [-3, 7, -9, 28, 9]
E             
E             At index 3 diff: 29 != 28
E             Use -v to get more diff

sdl2/test/sdlttf_test.py:394: AssertionError
______________________________ test_TTF_SizeText _______________________________

with_font = <ctypes.LP_TTF_Font object at 0x7fb1fa010550>

    def test_TTF_SizeText(with_font):
        font = with_font
        min_expected_w = 69     # SDL2_ttf 2.0.18
        max_expected_w = 70     # SDL2_ttf <= 2.0.15
        min_expected_h = 21     # SDL2_ttf 2.0.15 with FreeType 2.10.1
        max_expected_h = 25     # SDL2_ttf < 2.0.15
        w, h = c_int(0), c_int(0)
        sdlttf.TTF_SizeText(font, b"Hi there!", byref(w), byref(h))
>       assert w.value >= min_expected_w
E       assert 67 >= 69
E        +  where 67 = c_int(67).value

sdl2/test/sdlttf_test.py:405: AssertionError
______________________________ test_TTF_SizeUTF8 _______________________________

with_font = <ctypes.LP_TTF_Font object at 0x7fb1fa010b90>

    def test_TTF_SizeUTF8(with_font):
        font = with_font
        min_expected_w = 72     # SDL2_ttf 2.0.18
        max_expected_w = 73     # SDL2_ttf <= 2.0.15
        min_expected_h = 21     # SDL2_ttf 2.0.15 with FreeType 2.10.1
        max_expected_h = 25     # SDL2_ttf < 2.0.15
        w, h = c_int(0), c_int(0)
        sdlttf.TTF_SizeUTF8(font, u"Hï thère!".encode('utf-8'), byref(w), byref(h))
>       assert w.value >= min_expected_w
E       assert 70 >= 72
E        +  where 70 = c_int(70).value

sdl2/test/sdlttf_test.py:418: AssertionError
_____________________________ test_TTF_SizeUNICODE _____________________________

with_font = <ctypes.LP_TTF_Font object at 0x7fb1fa010690>

    def test_TTF_SizeUNICODE(with_font):
        font = with_font
        min_expected_w = 69     # SDL2_ttf 2.0.18
        max_expected_w = 70     # SDL2_ttf <= 2.0.15
        min_expected_h = 21     # SDL2_ttf 2.0.15 with FreeType 2.10.1
        max_expected_h = 25     # SDL2_ttf < 2.0.15
        w, h = c_int(0), c_int(0)
        strarr = to_utf16(u"Hi there!")
        sdlttf.TTF_SizeUNICODE(font, strarr, byref(w), byref(h))
        # For debug purposes
        #print(list(strarr))
        #print("w = {0}, h = {1}".format(w.value, h.value))
>       assert w.value >= min_expected_w
E       assert 67 >= 69
E        +  where 67 = c_int(67).value


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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.15/fedora-rawhide-x86_64/09789919-python-pysdl2/

For all our attempts to build python-pysdl2 with Python 3.15, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/package/python-pysdl2/

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.15:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/

Let us know here if you have any questions.

Python 3.15 is planned to be included in Fedora 45.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.15.
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 1 Sandro 2025-11-15 20:12:34 UTC
It looks like the tests need adapting to FreeType 2.14.x.

Comment 2 Fedora Update System 2025-11-16 09:06:30 UTC
FEDORA-2025-b18958a4e3 (python-pysdl2-0.9.17-8.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-b18958a4e3

Comment 3 Fedora Update System 2025-11-16 09:13:27 UTC
FEDORA-2025-b18958a4e3 (python-pysdl2-0.9.17-8.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.


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