diff --git a/fe6aedd.patch b/fe6aedd.patch new file mode 100644 index 0000000..331e3bc --- /dev/null +++ b/fe6aedd.patch @@ -0,0 +1,48 @@ +From fe6aedd8eebd92844b873f72e99dc4023316c6f3 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Wed, 7 Jun 2023 22:27:55 +0200 +Subject: [PATCH] tests: fix test_gvalue_flat_array_in_item_marshal_failure for + Python 3.12 + +See https://gitlab.gnome.org/GNOME/pygobject/-/issues/582 + +_PyGI_ERROR_PREFIX() no longer works with 3.12 since we only get normalized +exceptions in there and can't add a prefix like "Item X: " to the message. + +Until we figure out how to add this back for 3.12, align the tests with the +new behaviour (the new exception notes API would be an option, see the +linked issue) +--- + tests/test_gi.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/tests/test_gi.py b/tests/test_gi.py +index 25a3b659..261d8b2b 100644 +--- a/tests/test_gi.py ++++ b/tests/test_gi.py +@@ -1573,9 +1573,12 @@ class TestGValue(unittest.TestCase): + self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array, + [GLib.MININT - 1, "42", True]) + ++ # FIXME: https://gitlab.gnome.org/GNOME/pygobject/-/issues/582#note_1764164 ++ exc_prefix = "Item 0: " if sys.version_info[:2] < (3, 12) else "" ++ + with pytest.raises( + OverflowError, +- match='Item 0: %d not in range %d to %d' % ( ++ match=exc_prefix + '%d not in range %d to %d' % ( + GLib.MAXINT + 1, GLib.MININT, GLib.MAXINT)): + GIMarshallingTests.gvalue_flat_array([GLib.MAXINT + 1, "42", True]) + +@@ -1583,7 +1586,7 @@ class TestGValue(unittest.TestCase): + + with pytest.raises( + OverflowError, +- match='Item 0: %d not in range %d to %d' % ( ++ match=exc_prefix + '%d not in range %d to %d' % ( + GLib.MAXUINT64 * 2, min_, max_)): + GIMarshallingTests.gvalue_flat_array([GLib.MAXUINT64 * 2, "42", True]) + +-- +GitLab + diff --git a/pygobject3.spec b/pygobject3.spec index 602363f..8fed89f 100644 --- a/pygobject3.spec +++ b/pygobject3.spec @@ -12,6 +12,9 @@ License: LGPL-2.1-or-later URL: https://wiki.gnome.org/Projects/PyGObject Source0: https://download.gnome.org/sources/pygobject/3.44/pygobject-%{version}.tar.xz +# Compatibility with Python 3.12 +Patch: https://gitlab.gnome.org/GNOME/pygobject/-/commit/fe6aedd.patch + BuildRequires: pkgconfig(cairo-gobject) BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} BuildRequires: pkgconfig(gobject-introspection-1.0) >= %{gobject_introspection_version}