[pygobject] Fix erronous import statements for Python 3.3



commit 1bee194274bcda9ba5f6751fa921218a92c8ac72
Author: Simon Feltman <s feltman gmail com>
Date:   Thu Aug 16 16:05:52 2012 -0700

    Fix erronous import statements for Python 3.3
    
    Update pygobject-external.h to use GType (which is what GTypeWrapper is
    exposed as) instead of GTypeWrapper when attempting import.
    
    Catch ImportError around attempted imports of a typelibs override file
    which don't always exist (GObject...). This is a behavioural change in
    Python 3.3 (http://bugs.python.org/issue15715), but let's fix it anyway.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682051

 gi/module.py            |    7 +++++--
 gi/pygobject-external.h |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gi/module.py b/gi/module.py
index 2d02c9a..0fccbe6 100644
--- a/gi/module.py
+++ b/gi/module.py
@@ -240,9 +240,12 @@ class DynamicModule(types.ModuleType):
         version = gi.get_required_version(self._namespace)
         self._introspection_module = IntrospectionModule(self._namespace,
                                                          version)
+        try:
+            overrides_modules = __import__('gi.overrides', fromlist=[self._namespace])
+            self._overrides_module = getattr(overrides_modules, self._namespace, None)
+        except ImportError:
+            self._overrides_module = None
 
-        overrides_modules = __import__('gi.overrides', fromlist=[self._namespace])
-        self._overrides_module = getattr(overrides_modules, self._namespace, None)
         self.__path__ = repository.get_typelib_path(self._namespace)
         if _have_py3:
             # get_typelib_path() delivers bytes, not a string
diff --git a/gi/pygobject-external.h b/gi/pygobject-external.h
index 4d873bc..113c229 100644
--- a/gi/pygobject-external.h
+++ b/gi/pygobject-external.h
@@ -45,7 +45,7 @@ _pygobject_import (void)
         return 1;
     }
 
-    from_list = Py_BuildValue ("(ss)", "GObject", "GTypeWrapper");
+    from_list = Py_BuildValue ("(ss)", "GObject", "GType");
     if (from_list == NULL) {
         return -1;
     }



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