From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Johannes Berg <johannes@sipsolutions.net>,
Josef Bacik <jbacik@fb.com>, Darren Hart <dvhart@infradead.org>,
troyengel@gmail.com
Subject: [PATCH 1/3] trace-cmd: Replace PySting_FromString() with PyUnicode_FromString()
Date: Fri, 19 Jul 2019 18:46:14 -0400 [thread overview]
Message-ID: <20190719225030.187908166@goodmis.org> (raw)
In-Reply-To: 20190719224613.207069107@goodmis.org
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Python 3 has deprecated PyString_FromString(), but both Python 2 and
Python 3 have PyUnicode_FromString() which should be equivalent (at least
according to google). As Python 2 is going to be EOL soon, we need to
support Python 3.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204231
Reported-by: Troy Engel <troyengel@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
python/ctracecmd.i | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/python/ctracecmd.i b/python/ctracecmd.i
index 65a3d5144b88..09d1d6414fc1 100644
--- a/python/ctracecmd.i
+++ b/python/ctracecmd.i
@@ -108,7 +108,7 @@ static PyObject *py_field_get_stack(struct tep_handle *pevent,
((int)addr == -1))
break;
func = tep_find_function(event->tep, addr);
- if (PyList_Append(list, PyString_FromString(func))) {
+ if (PyList_Append(list, PyUnicode_FromString(func))) {
Py_DECREF(list);
return NULL;
}
@@ -162,10 +162,10 @@ static PyObject *py_field_get_str(struct tep_format_field *f, struct tep_record
*/
offset = val & 0xffff;
- return PyString_FromString((char *)r->data + offset);
+ return PyUnicode_FromString((char *)r->data + offset);
}
- return PyString_FromStringAndSize((char *)r->data + f->offset,
+ return PyUnicode_FromStringAndSize((char *)r->data + f->offset,
strnlen((char *)r->data + f->offset, f->size));
}
@@ -177,7 +177,7 @@ static PyObject *py_format_get_keys(struct tep_event *ef)
list = PyList_New(0);
for (f = ef->format.fields; f; f = f->next) {
- if (PyList_Append(list, PyString_FromString(f->name))) {
+ if (PyList_Append(list, PyUnicode_FromString(f->name))) {
Py_DECREF(list);
return NULL;
}
--
2.20.1
next prev parent reply other threads:[~2019-07-19 22:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 22:46 [PATCH 0/3] trace-cmd: Update python plugin for Python 3 Steven Rostedt
2019-07-19 22:46 ` Steven Rostedt [this message]
2019-07-26 7:29 ` [PATCH 1/3] trace-cmd: Replace PySting_FromString() with PyUnicode_FromString() Johannes Berg
2019-07-19 22:46 ` [PATCH 2/3] trace-cmd: Use PyMemoryView_FromMemory() for Python 3 Steven Rostedt
2019-07-26 7:30 ` Johannes Berg
2019-07-19 22:46 ` [PATCH 3/3] trace-cmd: Use PyLong_AsLong() " Steven Rostedt
2019-07-26 7:31 ` Johannes Berg
2019-07-26 15:18 ` Steven Rostedt
2019-07-26 15:22 ` Johannes Berg
2019-07-26 15:30 ` Steven Rostedt
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=20190719225030.187908166@goodmis.org \
--to=rostedt@goodmis.org \
--cc=dvhart@infradead.org \
--cc=jbacik@fb.com \
--cc=johannes@sipsolutions.net \
--cc=linux-trace-devel@vger.kernel.org \
--cc=troyengel@gmail.com \
/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).