Bug 2359492

Summary: python-zmq fails to build with Python 3.14: AssertionErrors in TestFrame, related to refcounts
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-zmqAssignee: Ben Beasley <code>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: code, infra-sig, ksurma, mhroncok, mrunge
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-zmq-26.4.0-3.fc43 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-04-14 16:04:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2322407    

Description Karolina Surma 2025-04-14 13:01:24 UTC
python-zmq fails to build with Python 3.14.0a7.

___________________________ TestFrame.test_above_30 ____________________________

self = <tests.test_message.TestFrame testMethod=test_above_30>

    @skip_pypy
    def test_above_30(self):
        """Message above 30 bytes are never copied by 0MQ."""
        for i in range(5, 16):  # 32, 64,..., 65536
            s = (2**i) * x
            rc = grc(s)
            m = zmq.Frame(s, copy=False)
            assert grc(s) == rc + 2
            del m
            await_gc(s, rc)
>           assert grc(s) == rc
E           AssertionError: assert 2 == 1
E            +  where 2 = grc(b'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')

tests/test_message.py:67: AssertionError
__________________________ TestFrame.test_lifecycle1 ___________________________

self = <tests.test_message.TestFrame testMethod=test_lifecycle1>

    @skip_pypy
    def test_lifecycle1(self):
        """Run through a ref counting cycle with a copy."""
        for i in range(5, 16):  # 32, 64,..., 65536
            s = (2**i) * x
            rc = rc_0 = grc(s)
            m = zmq.Frame(s, copy=False)
            rc += 2
            assert grc(s) == rc
            m2 = copy.copy(m)
            rc += 1
            assert grc(s) == rc
            # no increase in refcount for accessing buffer
            # which references m2 directly
            buf = m2.buffer
            assert grc(s) == rc
    
            assert s == bytes(m2)
            assert s == m.bytes
            assert s == bytes(buf)
            del m2
            assert grc(s) == rc
            # buf holds direct reference to m2 which holds
            del buf
            rc -= 1
            assert grc(s) == rc
            del m
            rc -= 2
            await_gc(s, rc)
>           assert grc(s) == rc
E           AssertionError: assert 2 == 1
E            +  where 2 = grc(b'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')

tests/test_message.py:141: AssertionError
__________________________ TestFrame.test_lifecycle2 ___________________________

self = <tests.test_message.TestFrame testMethod=test_lifecycle2>

    @skip_pypy
    def test_lifecycle2(self):
        """Run through a different ref counting cycle with a copy."""
        for i in range(5, 16):  # 32, 64,..., 65536
            s = (2**i) * x
            rc = rc_0 = grc(s)
            m = zmq.Frame(s, copy=False)
            rc += 2
            assert grc(s) == rc
            m2 = copy.copy(m)
            rc += 1
            assert grc(s) == rc
            # no increase in refcount for accessing buffer
            # which references m directly
            buf = m.buffer
            assert grc(s) == rc
            assert s == bytes(m2)
            assert s == m2.bytes
            assert s == m.bytes
            assert s == bytes(buf)
            del buf
            assert grc(s) == rc
            del m
            rc -= 1
            assert grc(s) == rc
            del m2
            rc -= 2
            await_gc(s, rc)
>           assert grc(s) == rc
E           AssertionError: assert 2 == 1
E            +  where 2 = grc(b'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')


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/08899595-python-zmq/

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

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 Fedora Update System 2025-04-14 14:17:08 UTC
FEDORA-2025-18dd1b5343 (python-zmq-26.4.0-3.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-18dd1b5343

Comment 2 Fedora Update System 2025-04-14 16:04:02 UTC
FEDORA-2025-18dd1b5343 (python-zmq-26.4.0-3.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.