Bug 2345516 - python-trio fails to build with Python 3.14: test_ki_protection_doesnt_leave_cyclic_garbage: Left contains one more item: <coroutine object test_ki_protection_doesnt_leave_cyclic_garbage at 0x7fbaa2f162c0>
Summary: python-trio fails to build with Python 3.14: test_ki_protection_doesnt_leave_...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: python-trio
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-02-13 11:07 UTC by Karolina Surma
Modified: 2025-02-13 19:15 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github python-trio trio issues 3209 0 None open Python 3.14: test_ki_protection_doesnt_leave_cyclic_garbage fails 2025-02-13 16:53:59 UTC
Github python cpython issues 125603 0 None open [3.14] change in behaviour in gc.get_referrers(some_local) 2025-02-13 16:56:07 UTC

Description Karolina Surma 2025-02-13 11:07:18 UTC
python-trio fails to build with Python 3.14.05.

________________ test_ki_protection_doesnt_leave_cyclic_garbage ________________

    @pytest.mark.skipif(
        sys.implementation.name != "cpython",
        reason="Only makes sense with refcounting GC",
    )
    async def test_ki_protection_doesnt_leave_cyclic_garbage() -> None:
        class MyException(Exception):
            pass
    
        async def demo() -> None:
            async def handle_error() -> None:
                try:
                    raise MyException
                except MyException as e:
                    exceptions.append(e)
    
            exceptions: list[MyException] = []
            try:
                async with _core.open_nursery() as n:
                    n.start_soon(handle_error)
                raise ExceptionGroup("errors", exceptions)
            finally:
                exceptions = []
    
        exc: Exception | None = None
        try:
            await demo()
        except ExceptionGroup as excs:
            exc = excs.exceptions[0]
    
        assert isinstance(exc, MyException)
>       assert gc.get_referrers(exc) == no_other_refs()
E       assert [<coroutine o...7fbaa2f162c0>] == []
E         
E         Left contains one more item: <coroutine object test_ki_protection_doesnt_leave_cyclic_garbage at 0x7fbaa2f162c0>
E         
E         Full diff:
E         - []
E         + [
E         +     <coroutine object test_ki_protection_doesnt_leave_cyclic_garbage at 0x7fbaa2f162c0>,
E         + ]

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/08651119-python-trio/

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

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 1 Ben Beasley 2025-02-13 16:54:00 UTC
Reproduced in a virtualenv and reported upstream: https://github.com/python-trio/trio/issues/3209

Comment 2 Ben Beasley 2025-02-13 16:56:07 UTC
This appears to be caused by https://github.com/python/cpython/issues/125603.

Comment 3 Ben Beasley 2025-02-13 16:57:35 UTC
A proposed fix exists in https://github.com/python/cpython/pull/125640, so this may be solved upstream in CPython before 3.14.0 final.

Comment 4 Ben Beasley 2025-02-13 16:59:08 UTC
Assigning this to myself since I’m now keeping an eye on the CPython issue.

Comment 5 Ben Beasley 2025-02-13 19:15:13 UTC
Upon reflection, I think it would make sense to skip this test on Python 3.14 for the time being, since it seems clear that the issue is in CPython and that it is breaking the *test*, not the *implementation*.

https://src.fedoraproject.org/rpms/python-trio/pull-request/10


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