]> sigrok.org Git - libsigrok.git/blobdiff - bindings/python/sigrok/core/classes.i
C++: Use move() and avoid passing containers by value
[libsigrok.git] / bindings / python / sigrok / core / classes.i
index be4df153080d5149b897b574cb1c5c0c109e38bd..9dd34ac61caaac6a95c31db812a83b8250e25b2a 100644 (file)
@@ -47,6 +47,7 @@ which provides access to the error code and description."
 %{
 #include <stdio.h>
 #include <pygobject.h>
+#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
 #include <numpy/arrayobject.h>
 
 PyObject *PyGObject_lib;
@@ -74,7 +75,7 @@ typedef guint pyg_flags_type;
     if (!GLib) {
         fprintf(stderr, "Import of gi.repository.GLib failed.\n");
 #if PY_VERSION_HEX >= 0x03000000
-        return NULL;
+        return nullptr;
 #else
         return;
 #endif
@@ -82,6 +83,8 @@ typedef guint pyg_flags_type;
     import_array();
 %}
 
+%include "../../../swig/templates.i"
+
 /* Map file objects to file descriptors. */
 %typecheck(SWIG_TYPECHECK_POINTER) int fd {
     $1 = (PyObject_AsFileDescriptor($input) != -1);
@@ -94,8 +97,7 @@ typedef guint pyg_flags_type;
     g_value_set_variant(value, $1.gobj());
     PyObject *variant = pyg_value_as_pyobject(value, true);
     $result = PyObject_CallMethod(variant,
-        const_cast<char *>("unpack"),
-        const_cast<char *>(""), NULL);
+        const_cast<char *>("unpack"), nullptr);
     Py_XDECREF(variant);
     g_free(value);
 }