See:
http://lists.fedoraproject.org/pipermail/devel/2010-August/141064.html
fi
AC_MSG_RESULT([not found])
done
fi
AC_MSG_RESULT([not found])
done
+
+ old_LIBS="$LIBS"
+ LIBS="$LIBS -lpython$PYTHON_VERSION"
+ AC_CHECK_FUNCS([PyCapsule_New])
+ LIBS="$old_LIBS"
fi
AC_SUBST(PYTHON_PREFIX)
fi
AC_SUBST(PYTHON_PREFIX)
+#ifndef HAVE_PYCAPSULE_NEW
typedef struct {
PyObject_HEAD
guestfs_h *g;
} Pyguestfs_Object;
typedef struct {
PyObject_HEAD
guestfs_h *g;
} Pyguestfs_Object;
static guestfs_h *
get_handle (PyObject *obj)
{
assert (obj);
assert (obj != Py_None);
static guestfs_h *
get_handle (PyObject *obj)
{
assert (obj);
assert (obj != Py_None);
+#ifndef HAVE_PYCAPSULE_NEW
return ((Pyguestfs_Object *) obj)->g;
return ((Pyguestfs_Object *) obj)->g;
+#else
+ return (guestfs_h*) PyCapsule_GetPointer(obj, \"guestfs_h\");
+#endif
}
static PyObject *
put_handle (guestfs_h *g)
{
assert (g);
}
static PyObject *
put_handle (guestfs_h *g)
{
assert (g);
+#ifndef HAVE_PYCAPSULE_NEW
return
PyCObject_FromVoidPtrAndDesc ((void *) g, (char *) \"guestfs_h\", NULL);
return
PyCObject_FromVoidPtrAndDesc ((void *) g, (char *) \"guestfs_h\", NULL);
+#else
+ return PyCapsule_New ((void *) g, \"guestfs_h\", NULL);
+#endif
}
/* This list should be freed (but not the strings) after use. */
}
/* This list should be freed (but not the strings) after use. */
return NULL;
}
guestfs_set_error_handler (g, NULL, NULL);
return NULL;
}
guestfs_set_error_handler (g, NULL, NULL);
+ /* This can return NULL, but in that case put_handle will have
+ * set the Python error string.
+ */