From: Patrick McLean <chutzpah@gentoo.org>
To: linux-trace-devel@vger.kernel.org
Subject: [PATCH 3/3] trace-cmd: In the ctracecmdgui use PyLong on Python 3
Date: Thu, 25 Jul 2019 10:41:38 -0700 [thread overview]
Message-ID: <20190725174138.3724131-4-chutzpah@gentoo.org> (raw)
In-Reply-To: <20190725174138.3724131-1-chutzpah@gentoo.org>
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 --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
prev parent reply other threads:[~2019-07-25 17:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 17:41 [PATCH 0/3] trace-cmd: More Python 3 cleanups Patrick McLean
2019-07-25 17:41 ` [PATCH 1/3] trace-cmd: in python plugin, use PyUnicode_FromString on Python 3 Patrick McLean
2019-07-25 18:04 ` Steven Rostedt
2019-07-25 19:28 ` Steven Rostedt
2019-07-25 17:41 ` [PATCH 2/3] trace-cmd: Add missing headers to Python template Patrick McLean
2019-07-25 17:41 ` Patrick McLean [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190725174138.3724131-4-chutzpah@gentoo.org \
--to=chutzpah@gentoo.org \
--cc=linux-trace-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).