Message ID | 20190725174138.3724131-4-chutzpah@gentoo.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | trace-cmd: More Python 3 cleanups | expand |
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); }