Bug 2203773

Summary: python-urllib3 fails to build with Python 3.12: AssertionError: assert <class 'NoneType'> == list
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-urllib3Assignee: Fedora Infrastructure SIG <infra-sig>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: aurelien, infra-sig, jeremy, kevin, mhroncok, python-packagers-sig, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-urllib3-1.26.12-3.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-16 17:21:14 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: 2135404    

Description Tomáš Hrnčiar 2023-05-15 08:35:09 UTC
python-urllib3 fails to build with Python 3.12.0a7.

=================================== FAILURES ===================================
______________ SingleTLSLayerTestCase.test_ssl_object_attributes _______________

self = <test.test_ssltransport.SingleTLSLayerTestCase object at 0x7f88718bf020>

    @pytest.mark.timeout(PER_TEST_TIMEOUT)
    def test_ssl_object_attributes(self):
        """Ensures common ssl attributes are exposed"""
        self.start_dummy_server()
    
        sock = socket.create_connection((self.host, self.port))
        with SSLTransport(
            sock, self.client_context, server_hostname="localhost"
        ) as ssock:
            cipher = ssock.cipher()
            assert type(cipher) == tuple
    
            # No chosen protocol through ALPN or NPN.
            assert ssock.selected_alpn_protocol() is None
            assert ssock.selected_npn_protocol() is None
    
            shared_ciphers = ssock.shared_ciphers()
>           assert type(shared_ciphers) == list
E           AssertionError: assert <class 'NoneType'> == list
E            +  where <class 'NoneType'> = type(None)

test/test_ssltransport.py:205: AssertionError

=========================== short test summary info ============================
FAILED test/test_ssltransport.py::SingleTLSLayerTestCase::test_ssl_object_attributes
=========== 1 failed, 721 passed, 8 skipped, 1572 warnings in 16.50s ===========

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05918287-python-urllib3/

For all our attempts to build python-urllib3 with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-urllib3/

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

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Miro Hrončok 2023-05-15 08:50:46 UTC
This is a very important package in the Python stack, hence setting severity to high.

Comment 2 Kevin Fenzi 2023-05-15 17:31:41 UTC
Related: https://github.com/urllib3/urllib3/pull/2959

May be fixed in newer upstream releases?

Comment 3 Miro Hrončok 2023-05-16 08:48:30 UTC
I'd be relatively slow with updating this to version 2. Two releases were already yanked from PyPI. Backporting might be safer, if possible.

Comment 4 Tomáš Hrnčiar 2023-05-16 09:57:43 UTC
Also, there are *a lot* changes in version 2. https://github.com/urllib3/urllib3/blob/main/CHANGES.rst

(In reply to Kevin Fenzi from comment #2)
> Related: https://github.com/urllib3/urllib3/pull/2959
> 

Thank you for the link, with this commit the build succeeded.

Comment 5 Tomáš Hrnčiar 2023-05-16 10:17:56 UTC
PR: https://bugzilla.redhat.com/show_bug.cgi?id=2203773

Comment 6 Tomáš Hrnčiar 2023-05-16 10:19:55 UTC
oops, wrong paste

https://src.fedoraproject.org/rpms/python-urllib3/pull-request/19

Comment 7 Fedora Update System 2023-05-16 17:19:39 UTC
FEDORA-2023-7466f8fa74 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-7466f8fa74

Comment 8 Fedora Update System 2023-05-16 17:21:14 UTC
FEDORA-2023-7466f8fa74 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.