diff mbox series

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

Message ID 20190725174138.3724131-4-chutzpah@gentoo.org (mailing list archive)
State Accepted
Headers show
Series trace-cmd: More Python 3 cleanups | expand

Commit Message

Patrick McLean July 25, 2019, 5:41 p.m. UTC
From: Patrick McLean <patrick.mclean@sony.com>

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

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

Patch

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);
 }