Skip to content
Browse files

Use Capsules in Python.

  • Loading branch information...
1 parent 07d5ebd commit f8526ef71fb3c4b7fc8003a18360e1407e153f4b @0xd34df00d committed Sep 28, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/bindings/python/qrosspython/pythonvariant.cpp
View
4 src/bindings/python/qrosspython/pythonvariant.cpp
@@ -169,6 +169,9 @@ Py::Object PythonType<QVariant>::toPyObject(const QVariant& v)
}
try {
+#if defined(SIP_USE_PYCAPSULE)
+ const sipAPIDef *sipApi = (const sipAPIDef *)PyCapsule_Import("sip._C_API", 0);
+#else
PyObject *sip_module;
PyObject *sip_module_dict;
PyObject *c_api;
@@ -182,6 +185,7 @@ Py::Object PythonType<QVariant>::toPyObject(const QVariant& v)
if (!PyCObject_Check(c_api))
throw std::runtime_error ("Sanity checks for C API failed.");
const sipAPIDef *sipApi = (const sipAPIDef *)PyCObject_AsVoidPtr(c_api);
+#endif
if (!sipApi)
qrosswarning ("PythonType<QVariant>::toPyObject() could not get C API");

0 comments on commit f8526ef

Please sign in to comment.
Something went wrong with that request. Please try again.