[pygobject] Don't raise an error in _pygi_import if pygi support is disabled



commit 23fc0f615d87994acafd9d39e92dd92b587fc2eb
Author: Simon van der Linden <svdlinden src gnome org>
Date:   Thu Jan 21 17:30:51 2010 +0100

    Don't raise an error in _pygi_import if pygi support is disabled
    
    http://bugzilla.gnome.org/show_bug.cgi?id=607674

 gobject/pygboxed.c      |    6 +-----
 gobject/pygi-external.h |    1 -
 gobject/pygobject.c     |    6 +-----
 gobject/pygpointer.c    |    6 +-----
 4 files changed, 3 insertions(+), 16 deletions(-)
---
diff --git a/gobject/pygboxed.c b/gobject/pygboxed.c
index 1233b01..87695eb 100644
--- a/gobject/pygboxed.c
+++ b/gobject/pygboxed.c
@@ -185,12 +185,8 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
 
     tp = g_type_get_qdata(boxed_type, pygboxed_type_key);
 
-    if (tp == NULL) {
+    if (!tp)
         tp = (PyTypeObject *)pygi_type_import_by_g_type(boxed_type);
-        if (tp == NULL) {
-            PyErr_Clear();
-        }
-    }
 
     if (!tp)
 	tp = (PyTypeObject *)&PyGBoxed_Type; /* fallback */
diff --git a/gobject/pygi-external.h b/gobject/pygi-external.h
index e0d11c2..aec2f25 100644
--- a/gobject/pygi-external.h
+++ b/gobject/pygi-external.h
@@ -49,7 +49,6 @@ _pygi_import (void)
 
     return 0;
 #else
-    PyErr_SetString(PyExc_ImportError, "PyGI support not enabled");
     return -1;
 #endif /* ENABLE_PYGI */
 }
diff --git a/gobject/pygobject.c b/gobject/pygobject.c
index 222280b..f8d7dd1 100644
--- a/gobject/pygobject.c
+++ b/gobject/pygobject.c
@@ -874,12 +874,8 @@ pygobject_lookup_class(GType gtype)
     if (py_type == NULL) {
 	py_type = g_type_get_qdata(gtype, pyginterface_type_key);
 
-    if (py_type == NULL) {
+    if (py_type == NULL)
         py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype);
-        if (py_type == NULL) {
-            PyErr_Clear();
-        }
-    }
 
 	if (py_type == NULL) {
 	    py_type = pygobject_new_with_interfaces(gtype);
diff --git a/gobject/pygpointer.c b/gobject/pygpointer.c
index 449b80c..5f6417f 100644
--- a/gobject/pygpointer.c
+++ b/gobject/pygpointer.c
@@ -159,12 +159,8 @@ pyg_pointer_new(GType pointer_type, gpointer pointer)
 
     tp = g_type_get_qdata(pointer_type, pygpointer_class_key);
 
-    if (tp == NULL) {
+    if (!tp)
         tp = (PyTypeObject *)pygi_type_import_by_g_type(pointer_type);
-        if (tp == NULL) {
-            PyErr_Clear();
-        }
-    }
 
     if (!tp)
 	tp = (PyTypeObject *)&PyGPointer_Type; /* fallback */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]