linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Patrick McLean <chutzpah@gentoo.org>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 1/3] trace-cmd: in python plugin, use PyUnicode_FromString on Python 3
Date: Thu, 25 Jul 2019 14:04:09 -0400	[thread overview]
Message-ID: <20190725140409.1012b9dc@gandalf.local.home> (raw)
In-Reply-To: <20190725174138.3724131-2-chutzpah@gentoo.org>

On Thu, 25 Jul 2019 10:41:36 -0700
Patrick McLean <chutzpah@gentoo.org> wrote:

> From: Patrick McLean <patrick.mclean@sony.com>
> 
> All strings are unicode in Python 3, so PyString_* is no longer
> reccommended. This uses PyUnicode_* instead.
> 
> Signed-off-by: Patrick McLean <patrick.mclean@sony.com>
> ---
>  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

I believe using just PyUnicode_FromString() will work for both v2 and
v3. That's what I did in my other patches.

-- Steve

>  	if (!str)
>  		return -ENOMEM;
>  


  reply	other threads:[~2019-07-25 18:04 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 [this message]
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 ` [PATCH 3/3] trace-cmd: In the ctracecmdgui use PyLong on Python 3 Patrick McLean

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=20190725140409.1012b9dc@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=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).