From patchwork Thu Jul 25 17:41:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick McLean X-Patchwork-Id: 11059445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B8A66C5 for ; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5927A28A1E for ; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B82728A1F; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E041A28A20 for ; Thu, 25 Jul 2019 17:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730033AbfGYRly (ORCPT ); Thu, 25 Jul 2019 13:41:54 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:50578 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727951AbfGYRly (ORCPT ); Thu, 25 Jul 2019 13:41:54 -0400 Received: from chiana.gaikai.org (unknown [100.42.98.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: chutzpah) by smtp.gentoo.org (Postfix) with ESMTPSA id 05F1C34882D for ; Thu, 25 Jul 2019 17:41:53 +0000 (UTC) From: Patrick McLean To: linux-trace-devel@vger.kernel.org Subject: [PATCH 1/3] trace-cmd: in python plugin, use PyUnicode_FromString on Python 3 Date: Thu, 25 Jul 2019 10:41:36 -0700 Message-Id: <20190725174138.3724131-2-chutzpah@gentoo.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190725174138.3724131-1-chutzpah@gentoo.org> References: <20190725174138.3724131-1-chutzpah@gentoo.org> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Patrick McLean All strings are unicode in Python 3, so PyString_* is no longer reccommended. This uses PyUnicode_* instead. Signed-off-by: Patrick McLean Reported-by: Patrick McLean Signed-off-by: Steven Rostedt (VMware) --- plugins/plugin_python.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/plugin_python.c b/plugins/plugin_python.c index e725ad8..dc7932e 100644 --- a/plugins/plugin_python.c +++ b/plugins/plugin_python.c @@ -81,7 +81,11 @@ int TEP_PLUGIN_LOADER(struct tep_handle *pevent) } else Py_DECREF(res); +#if PY_MAJOR_VERSION >= 3 + str = PyUnicode_FromString("pevent"); +#else str = PyString_FromString("pevent"); +#endif if (!str) return -ENOMEM; From patchwork Thu Jul 25 17:41:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick McLean X-Patchwork-Id: 11059449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E462713A0 for ; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1EC228A17 for ; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D008228A21; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77F5328A17 for ; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727951AbfGYRlz (ORCPT ); Thu, 25 Jul 2019 13:41:55 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:50580 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbfGYRlz (ORCPT ); Thu, 25 Jul 2019 13:41:55 -0400 Received: from chiana.gaikai.org (unknown [100.42.98.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: chutzpah) by smtp.gentoo.org (Postfix) with ESMTPSA id 3B7C5348AAE for ; Thu, 25 Jul 2019 17:41:54 +0000 (UTC) From: Patrick McLean To: linux-trace-devel@vger.kernel.org Subject: [PATCH 2/3] trace-cmd: Add missing headers to Python template Date: Thu, 25 Jul 2019 10:41:37 -0700 Message-Id: <20190725174138.3724131-3-chutzpah@gentoo.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190725174138.3724131-1-chutzpah@gentoo.org> References: <20190725174138.3724131-1-chutzpah@gentoo.org> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Patrick McLean The templates that generate Python bindings are missing some headers that result in compile-time warnings. This adds the missing headers where needed. Signed-off-by: Patrick McLean --- python/ctracecmd.i | 1 + python/ctracecmdgui.i | 1 + 2 files changed, 2 insertions(+) diff --git a/python/ctracecmd.i b/python/ctracecmd.i index 2601d39..01cd0d5 100644 --- a/python/ctracecmd.i +++ b/python/ctracecmd.i @@ -16,6 +16,7 @@ %{ #include "trace-cmd.h" #include "event-utils.h" +#include %} diff --git a/python/ctracecmdgui.i b/python/ctracecmdgui.i index 1dcdab0..032f3ff 100644 --- a/python/ctracecmdgui.i +++ b/python/ctracecmdgui.i @@ -7,6 +7,7 @@ #include #include #include +#include extern GtkTreeModel *trace_view_store_as_gtk_tree_model(struct trace_view_store *store); From patchwork Thu Jul 25 17:41:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick McLean X-Patchwork-Id: 11059447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BCF9117EF for ; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9A6E287A3 for ; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E17428A1E; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5845728A0C for ; Thu, 25 Jul 2019 17:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730036AbfGYRlz (ORCPT ); Thu, 25 Jul 2019 13:41:55 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:50582 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727951AbfGYRlz (ORCPT ); Thu, 25 Jul 2019 13:41:55 -0400 Received: from chiana.gaikai.org (unknown [100.42.98.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: chutzpah) by smtp.gentoo.org (Postfix) with ESMTPSA id 7C67D348A57 for ; Thu, 25 Jul 2019 17:41:54 +0000 (UTC) From: Patrick McLean 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 Message-Id: <20190725174138.3724131-4-chutzpah@gentoo.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190725174138.3724131-1-chutzpah@gentoo.org> References: <20190725174138.3724131-1-chutzpah@gentoo.org> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Patrick McLean Python 3 does not have PyInt anymore, so use the PyLong_* functions when building on Python 3. Signed-off-by: Patrick McLean --- 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); }