Le lundi 25 mai 2009 à 20:12 +0200, Julien Valroff a écrit :
> 
> Many thanks for sharing your experience with this issue.
> 
> I am not able to reproduce the issue neither with listen. 
> 
> I keep you informed whether I manage to find anything useful...
> 
> Cheers,
> Julien
> 
tags 519758 patch
thanks


Hi,

I'm able to reproduce and fix the problem. For now, I can only reproduce
it on amd64, and after a reboot of my test machine.

The upstream bug relative to this is
http://bugzilla.gnome.org/show_bug.cgi?id=566571

It seems fixed with python-gobject >= 2.17. But I can confirm that
applying the patch included [1] in the bug report solve the problem.

It's also a known problem on Ubuntu and Fedora :
https://bugs.edge.launchpad.net/ubuntu/+source/pygobject/+bug/378592
https://bugzilla.redhat.com/show_bug.cgi?id=492737

Regards,
Julien Lavergne

[1] http://bugzilla.gnome.org/attachment.cgi?id=133131

>From 8dd1d31c6e009200af22c3c0c24fa4ae47233246 Mon Sep 17 00:00:00 2001
From: Paul Pogonyshev <[email protected]>
Date: Wed, 22 Apr 2009 21:08:49 +0300
Subject: [PATCH] Fix a crash in pyg_type_add_interfaces()

Reported as part of bug #566571.
---
 gobject/gobjectmodule.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index aecf937..73bfc3c 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -1079,16 +1079,20 @@ pyg_type_add_interfaces(PyTypeObject *class, GType instance_type,
 
     for (i = 0; i < PyTuple_GET_SIZE(bases); ++i) {
         guint k;
-        PyTypeObject *base = (PyTypeObject *) PyTuple_GET_ITEM(bases, i);
+        PyObject *base = PyTuple_GET_ITEM(bases, i);
         GType itype;
         gboolean is_new = TRUE;
         const GInterfaceInfo *iinfo;
         GInterfaceInfo iinfo_copy;
 
-        if (!PyType_IsSubtype(base, &PyGInterface_Type))
+        /* 'base' can also be a PyClassObject, see bug #566571. */
+        if (!PyType_Check(base))
             continue;
 
-        itype = pyg_type_from_object((PyObject *) base);
+        if (!PyType_IsSubtype((PyTypeObject*) base, &PyGInterface_Type))
+            continue;
+
+        itype = pyg_type_from_object(base);
 
         /* Happens for _implementations_ of an interface. */
         if (!G_TYPE_IS_INTERFACE(itype))
@@ -1109,7 +1113,7 @@ pyg_type_add_interfaces(PyTypeObject *class, GType instance_type,
             gchar *error;
             error = g_strdup_printf("Interface type %s "
                                     "has no Python implementation support",
-                                    base->tp_name);
+                                    ((PyTypeObject *) base)->tp_name);
             PyErr_Warn(PyExc_RuntimeWarning, error);
             g_free(error);
             continue;
-- 
1.6.2.4

Reply via email to