[nautilus-python/nautilus-3.0] The pygobject init function should use PyCapsule_Import if possible
- From: Adam Plumb <adamplumb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-python/nautilus-3.0] The pygobject init function should use PyCapsule_Import if possible
- Date: Wed, 23 Mar 2011 19:02:28 +0000 (UTC)
commit b457ff51180aa80603973dafd8e42bcdec305308
Author: Adam Plumb <adamplumb gmail com>
Date: Wed Mar 23 15:01:54 2011 -0400
The pygobject init function should use PyCapsule_Import if possible
src/nautilus-python.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-python.c b/src/nautilus-python.c
index d222140..6758d13 100644
--- a/src/nautilus-python.c
+++ b/src/nautilus-python.c
@@ -45,6 +45,14 @@ static GArray *all_types = NULL;
static inline gboolean
np_init_pygobject(void)
{
+#ifdef Py_CAPSULE_H
+ void *capsule = PyCapsule_Import("gobject._PyGObject_API", 0);
+ if (capsule)
+ {
+ _PyGObject_API = (struct _PyGObject_Functions*)capsule;
+ return TRUE;
+ }
+#endif
PyObject *gobject = PyImport_ImportModule("gobject");
if (gobject != NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]