[pygobject] Clear error if we failed the import



commit 46c91a11d448e5e11d142d3362aff1483226bca4
Author: Colin Walters <walters verbum org>
Date:   Wed May 5 13:54:27 2010 -0400

    Clear error if we failed the import
    
    Otherwise we leave the exception set which causes bizarre problems
    later in unrelated code.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=569885
    
    https://bugzilla.gnome.org/show_bug.cgi?id=617796

 gobject/pygi-external.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gobject/pygi-external.h b/gobject/pygi-external.h
index aec2f25..b369dca 100644
--- a/gobject/pygi-external.h
+++ b/gobject/pygi-external.h
@@ -27,11 +27,13 @@ _pygi_import (void)
 
     module = PyImport_ImportModule("gi");
     if (module == NULL) {
+        PyErr_Clear();
         return -1;
     }
 
     api = PyObject_GetAttrString(module, "_API");
     if (api == NULL) {
+        PyErr_Clear();
         Py_DECREF(module);
         return -1;
     }



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