[PATCH 3/3] trace-cmd: In the ctracecmdgui use PyLong on Python 3

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

 



From: Patrick McLean <patrick.mclean@xxxxxxxx>

Python 3 does not have PyInt anymore, so use the PyLong_* functions when
building on Python 3.

Signed-off-by: Patrick McLean <patrick.mclean@xxxxxxxx>
---
 python/ctracecmdgui.i | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/python/ctracecmdgui.i b/python/ctracecmdgui.i
index 032f3ff..4a7c6ac 100644
--- a/python/ctracecmdgui.i
+++ b/python/ctracecmdgui.i
@@ -37,12 +37,21 @@ pytype_from_gtype(GType gtype)
 }
 
 /* help swig cope with g* types */
+#if PY_MAJOR_VERSION >= 3
+%typemap(in) gint {
+    $1 = PyLong_AsLong($input);
+}
+%typemap(out) gint {
+    $result = PyLong_FromLong($1);
+}
+#else
 %typemap(in) gint {
     $1 = PyInt_AsLong($input);
 }
 %typemap(out) gint {
     $result = PyInt_FromLong($1);
 }
+#endif
 %typemap(in) guint {
     $1 = PyLong_AsUnsignedLong($input);
 }
-- 
2.22.0




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux