Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1948992

Summary: python-h2 fails to build with Python 3.10:
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-h2Assignee: Robert-André Mauchin 🐧 <zebob.m>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mhroncok, python-sig, thrnciar, zebob.m
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-15 06:35:18 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: 1890881    

Description Tomáš Hrnčiar 2021-04-13 08:22:09 UTC
python-h2 fails to build with Python 3.10.0a7.

=================================== FAILURES ===================================
_______________________ TestBasicServer.test_stream_repr _______________________

self = <test.test_basic_logic.TestBasicServer object at 0x7f305f7bfe20>

    def test_stream_repr(self):
        """
        Ensure stream string representation is appropriate.
        """
        s = h2.stream.H2Stream(4, None, 12, 14)
>       assert repr(s) == "<H2Stream id:4 state:<StreamState.IDLE: 0>>"
E       AssertionError: assert '<H2Stream id...amState.IDLE>' == '<H2Stream id...ate.IDLE: 0>>'
E         - <H2Stream id:4 state:<StreamState.IDLE: 0>>
E         ?                      -                --- -
E         + <H2Stream id:4 state:StreamState.IDLE>

test/test_basic_logic.py:1849: AssertionError
________________ TestEventReprs.test_remotesettingschanged_repr ________________

self = <test.test_events.TestEventReprs object at 0x7f305f335900>

    def test_remotesettingschanged_repr(self):
        """
        RemoteSettingsChanged has a useful debug representation.
        """
        e = h2.events.RemoteSettingsChanged()
        e.changed_settings = {
            h2.settings.SettingCodes.INITIAL_WINDOW_SIZE:
                h2.settings.ChangedSetting(
                    h2.settings.SettingCodes.INITIAL_WINDOW_SIZE, 2**16, 2**15
                ),
        }
    
>       assert repr(e) == (
            "<RemoteSettingsChanged changed_settings:{ChangedSetting("
            "setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, "
            "new_value=32768)}>"
        )
E       AssertionError: assert '<RemoteSetti...alue=32768)}>' == '<RemoteSetti...alue=32768)}>'
E         Skipping 54 identical leading characters in diff, use -v to show
E         - g(setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, new_value=32768)}>
E         ?           -------------
E         + g(setting=INITIAL_WINDOW_SIZE, original_value=65536, new_value=32768)}>

test/test_events.py:210: AssertionError
_____________________ TestEventReprs.test_streamreset_repr _____________________

self = <test.test_events.TestEventReprs object at 0x7f305f56c340>

    def test_streamreset_repr(self):
        """
        StreamEnded has a useful debug representation.
        """
        e = h2.events.StreamReset()
        e.stream_id = 919
        e.error_code = h2.errors.ErrorCodes.ENHANCE_YOUR_CALM
        e.remote_reset = False
    
>       assert repr(e) == (
            "<StreamReset stream_id:919, "
            "error_code:ErrorCodes.ENHANCE_YOUR_CALM, remote_reset:False>"
        )
E       AssertionError: assert '<StreamReset..._reset:False>' == '<StreamReset..._reset:False>'
E         - <StreamReset stream_id:919, error_code:ErrorCodes.ENHANCE_YOUR_CALM, remote_reset:False>
E         ?                                        -----------
E         + <StreamReset stream_id:919, error_code:ENHANCE_YOUR_CALM, remote_reset:False>

test/test_events.py:252: AssertionError
________________ TestEventReprs.test_settingsacknowledged_repr _________________

self = <test.test_events.TestEventReprs object at 0x7f305f334e80>

    def test_settingsacknowledged_repr(self):
        """
        SettingsAcknowledged has a useful debug representation.
        """
        e = h2.events.SettingsAcknowledged()
        e.changed_settings = {
            h2.settings.SettingCodes.INITIAL_WINDOW_SIZE:
                h2.settings.ChangedSetting(
                    h2.settings.SettingCodes.INITIAL_WINDOW_SIZE, 2**16, 2**15
                ),
        }
    
>       assert repr(e) == (
            "<SettingsAcknowledged changed_settings:{ChangedSetting("
            "setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, "
            "new_value=32768)}>"
        )
E       AssertionError: assert '<SettingsAck...alue=32768)}>' == '<SettingsAck...alue=32768)}>'
E         Skipping 53 identical leading characters in diff, use -v to show
E         - g(setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, new_value=32768)}>
E         ?           -------------
E         + g(setting=INITIAL_WINDOW_SIZE, original_value=65536, new_value=32768)}>

test/test_events.py:287: AssertionError
___________ TestEventReprs.test_connectionterminated_repr[None-None] ___________

self = <test.test_events.TestEventReprs object at 0x7f305f5d41f0>
additional_data = None, data_repr = 'None'

    @pytest.mark.parametrize("additional_data,data_repr", [
        (None, "None"),
        (b'some data', "736f6d652064617461")
    ])
    def test_connectionterminated_repr(self, additional_data, data_repr):
        """
        ConnectionTerminated has a useful debug representation.
        """
        e = h2.events.ConnectionTerminated()
        e.error_code = h2.errors.ErrorCodes.INADEQUATE_SECURITY
        e.last_stream_id = 33
        e.additional_data = additional_data
    
>       assert repr(e) == (
            "<ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, "
            "last_stream_id:33, additional_data:%s>" % data_repr
        )
E       AssertionError: assert '<ConnectionT...al_data:None>' == '<ConnectionT...al_data:None>'
E         - <ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, last_stream_id:33, additional_data:None>
E         ?                                  -----------
E         + <ConnectionTerminated error_code:INADEQUATE_SECURITY, last_stream_id:33, additional_data:None>

test/test_events.py:321: AssertionError
_ TestEventReprs.test_connectionterminated_repr[some data-736f6d652064617461] __

self = <test.test_events.TestEventReprs object at 0x7f305f336f50>
additional_data = b'some data', data_repr = '736f6d652064617461'

    @pytest.mark.parametrize("additional_data,data_repr", [
        (None, "None"),
        (b'some data', "736f6d652064617461")
    ])
    def test_connectionterminated_repr(self, additional_data, data_repr):
        """
        ConnectionTerminated has a useful debug representation.
        """
        e = h2.events.ConnectionTerminated()
        e.error_code = h2.errors.ErrorCodes.INADEQUATE_SECURITY
        e.last_stream_id = 33
        e.additional_data = additional_data
    
>       assert repr(e) == (
            "<ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, "
            "last_stream_id:33, additional_data:%s>" % data_repr
        )
E       AssertionError: assert '<ConnectionT...652064617461>' == '<ConnectionT...652064617461>'
E         - <ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, last_stream_id:33, additional_data:736f6d652064617461>
E         ?                                  -----------
E         + <ConnectionTerminated error_code:INADEQUATE_SECURITY, last_stream_id:33, additional_data:736f6d652064617461>

test/test_events.py:321: AssertionError
=========================== short test summary info ============================
FAILED test/test_basic_logic.py::TestBasicServer::test_stream_repr - Assertio...
FAILED test/test_events.py::TestEventReprs::test_remotesettingschanged_repr
FAILED test/test_events.py::TestEventReprs::test_streamreset_repr - Assertion...
FAILED test/test_events.py::TestEventReprs::test_settingsacknowledged_repr - ...
FAILED test/test_events.py::TestEventReprs::test_connectionterminated_repr[None-None]
FAILED test/test_events.py::TestEventReprs::test_connectionterminated_repr[some data-736f6d652064617461]
======================= 6 failed, 1408 passed in 33.81s ========================

There were some changes in repr() in latest alpha of Python 3.10.
https://docs.python.org/3.10/whatsnew/changelog.html#python-3-10-0-alpha-7

bpo-40066: Enum: adjust repr() to show only enum and member name (not value, nor angle brackets) and str() to show only member name. Update and improve documentation to match.

bpo-40066: Enum’s repr() and str() have changed: repr() is now EnumClass.MemberName and str() is MemberName. Additionally, stdlib Enum’s whose contents are available as module attributes, such as RegexFlag.IGNORECASE, have their repr() as module.name, e.g. re.IGNORECASE.
https://bugs.python.org/issue40066

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/02125805-python-h2/

For all our attempts to build python-h2 with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-h2/

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

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
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 Robert-André Mauchin 🐧 2021-04-13 20:25:22 UTC
@thrnciar I've pushed a fix, I tested it locally. Could you retry building the latest commit from the Rawhide branch?

Comment 2 Tomáš Hrnčiar 2021-04-14 06:30:22 UTC
Hello Robert,

thank you for a quick fix. When you push something to the rawhide branch it triggers a webhook to build it in our COPR[0]. The package is now building with Python 3.10.
I've tried to build it in rawhide using `fedpkg build` so we could close this as fixed in rawhide, but I haven't realized we are still at Python 3.9 in rawhide and it failed. I should have probably kept it at the previous version and not build the latest one. Is it okay if the package stays in FTBFS state till we update to Python 3.10 (approximately 2 months, see [1] for schedule) or do you want to revert the commit so it's not broken in rawhide? We could continue to build in our testing COPR with your patch. Apologies for any inconvenience. 

[0] https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-h2/
[1] https://fedoraproject.org/wiki/Changes/Python3.10#Important_dates_and_plan

Comment 3 Robert-André Mauchin 🐧 2021-04-14 14:53:13 UTC
(In reply to Tomáš Hrnčiar from comment #2)
> Hello Robert,
> 
> thank you for a quick fix. When you push something to the rawhide branch it
> triggers a webhook to build it in our COPR[0]. The package is now building
> with Python 3.10.
> I've tried to build it in rawhide using `fedpkg build` so we could close
> this as fixed in rawhide, but I haven't realized we are still at Python 3.9
> in rawhide and it failed. I should have probably kept it at the previous
> version and not build the latest one. Is it okay if the package stays in
> FTBFS state till we update to Python 3.10 (approximately 2 months, see [1]
> for schedule) or do you want to revert the commit so it's not broken in
> rawhide? We could continue to build in our testing COPR with your patch.
> Apologies for any inconvenience. 
> 

It's not an issue if the package stay FTBFS, if it builds with 3.10 it's all good.

Comment 4 Tomáš Hrnčiar 2021-04-15 06:35:18 UTC
Alright, thanks!