diff --git a/pygobject-3.8.1-bgo698366.patch b/pygobject-3.8.1-bgo698366.patch new file mode 100644 index 0000000..4c92a5e --- /dev/null +++ b/pygobject-3.8.1-bgo698366.patch @@ -0,0 +1,60 @@ +From 2a1c09fea76b3a1e696d9bb82c46e6c64ec574f9 Mon Sep 17 00:00:00 2001 +From: Simon Feltman +Date: Mon, 22 Apr 2013 10:43:23 +0000 +Subject: Change interpretation of NULL pointer field from None to 0 + +The usage of 0 is needed because these fields should generally +be used to store integer indices or hashes, not necessarily +pointers to actual data. + +https://bugzilla.gnome.org/show_bug.cgi?id=698366 +--- +diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c +index 6cb8417..7de90a2 100644 +--- a/gi/pygi-argument.c ++++ b/gi/pygi-argument.c +@@ -1529,18 +1529,9 @@ _pygi_argument_to_object (GIArgument *arg, + switch (type_tag) { + case GI_TYPE_TAG_VOID: + { +- if (g_type_info_is_pointer (type_info) && +- (arg->v_pointer != NULL)) { ++ if (g_type_info_is_pointer (type_info)) { + g_warn_if_fail (transfer == GI_TRANSFER_NOTHING); + object = PyLong_FromVoidPtr (arg->v_pointer); +- } else { +- /* None is used instead of zero for parity with ctypes. +- * This is helpful in case the values are being used for +- * actual memory addressing, in which case None will +- * raise as opposed to 0 which will crash. +- */ +- object = Py_None; +- Py_INCREF (object); + } + break; + } +diff --git a/tests/test_everything.py b/tests/test_everything.py +index 3c820d7..c5f9ac9 100644 +--- a/tests/test_everything.py ++++ b/tests/test_everything.py +@@ -505,7 +505,8 @@ class TestEverything(unittest.TestCase): + glist = GLib.List() + raw = RawGList.from_wrapped(glist) + +- self.assertEqual(glist.data, None) ++ # Note that pointer fields use 0 for NULL in PyGObject and None in ctypes ++ self.assertEqual(glist.data, 0) + self.assertEqual(raw.contents.data, None) + + glist.data = 123 +@@ -513,7 +514,7 @@ class TestEverything(unittest.TestCase): + self.assertEqual(raw.contents.data, 123) + + glist.data = None +- self.assertEqual(glist.data, None) ++ self.assertEqual(glist.data, 0) + self.assertEqual(raw.contents.data, None) + + # Setting to anything other than an int should raise +-- +cgit v0.9.1 diff --git a/pygobject3.spec b/pygobject3.spec index 2d36bb4..39c8b98 100644 --- a/pygobject3.spec +++ b/pygobject3.spec @@ -22,7 +22,7 @@ Name: pygobject3 Version: 3.8.1 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ and MIT Group: Development/Languages Summary: Python 2 bindings for GObject Introspection @@ -75,6 +75,9 @@ Patch3: test-list-marshalling.patch # https://bugzilla.gnome.org/show_bug.cgi?id=697138 Patch5: pygobject-3.8.0-known-failures.txt +# https://bugzilla.gnome.org/show_bug.cgi?id=698366 +Patch6: pygobject-3.8.1-bgo698366.patch + ### Build Dependencies ### BuildRequires: chrpath @@ -157,6 +160,7 @@ for use in Python 3 programs. %patch2 -p1 -b .known-failures %patch3 -p1 -b .test-list-marshalling %patch5 -p1 +%patch6 -p1 %if 0%{?with_python3} rm -rf %{py3dir} @@ -268,6 +272,9 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity} %endif # with_python3 %changelog +* Thu Apr 25 2013 Peter Robinson 3.8.1-2 +- Add upstream patch to fix Sugar (RHBZ 947538) + * Mon Apr 15 2013 Kalev Lember - 3.8.1-1 - Update to 3.8.1