Bug 2183186

Summary: pygobject3 fails to build with Python 3.12: AssertionError: Regex pattern did not match.
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: pygobject3Assignee: Colin Walters <walters>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: icq, mhroncok, thrnciar, walters
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: 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    
Attachments:
Description Flags
possible patch/workaround none

Description Tomáš Hrnčiar 2023-03-30 14:16:07 UTC
Created attachment 1954692 [details]
possible patch/workaround

pygobject3 fails to build with Python 3.12.0a6.

=================================== FAILURES ===================================
__________ TestGValue.test_gvalue_flat_array_in_item_marshal_failure ___________

self = <tests.test_gi.TestGValue testMethod=test_gvalue_flat_array_in_item_marshal_failure>

    def test_gvalue_flat_array_in_item_marshal_failure(self):
        # Tests the failure to marshal 2^256 to a GValue mid-way through the array marshaling.
        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
                          [42, 2 ** 256, True])
    
        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
                          [GLib.MAXINT + 1, "42", True])
        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
                          [GLib.MININT - 1, "42", True])
    
        with pytest.raises(
                OverflowError,
                match='Item 0: %d not in range %d to %d' % (
                    GLib.MAXINT + 1, GLib.MININT, GLib.MAXINT)):
>           GIMarshallingTests.gvalue_flat_array([GLib.MAXINT + 1, "42", True])
E           OverflowError: 2147483648 not in range -2147483648 to 2147483647

../tests/test_gi.py:1580: OverflowError

During handling of the above exception, another exception occurred:

self = <tests.test_gi.TestGValue testMethod=test_gvalue_flat_array_in_item_marshal_failure>

    def test_gvalue_flat_array_in_item_marshal_failure(self):
        # Tests the failure to marshal 2^256 to a GValue mid-way through the array marshaling.
        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
                          [42, 2 ** 256, True])
    
        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
                          [GLib.MAXINT + 1, "42", True])
        self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
                          [GLib.MININT - 1, "42", True])
    
>       with pytest.raises(
                OverflowError,
                match='Item 0: %d not in range %d to %d' % (
                    GLib.MAXINT + 1, GLib.MININT, GLib.MAXINT)):
E                   AssertionError: Regex pattern did not match.
E                    Regex: 'Item 0: 2147483648 not in range -2147483648 to 2147483647'
E                    Input: '2147483648 not in range -2147483648 to 2147483647'

To workaround this, I'll remove "Item 0: " from regex and build it in COPR this way so the package builds. I could use some help in figuring out if it's a proper solution or if something else should be done. 

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/05725952-pygobject3/

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

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 Fedora Release Engineering 2023-08-16 07:12:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.