From 86baff28b37727810f5a282096d79bb68e7bdac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Fri, 21 Aug 2015 21:15:56 +0200 Subject: [PATCH] Allow script source and name to be unicode on Python 2.x also --- src/_frida.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/_frida.c b/src/_frida.c index 5a389ce..e86361e 100644 --- a/src/_frida.c +++ b/src/_frida.c @@ -1310,16 +1310,20 @@ static PyObject * PySession_create_script (PySession * self, PyObject * args, PyObject * kw) { static char * keywords[] = { "source", "name", NULL }; - const char * source, * name = NULL; + char * source, * name = NULL; GError * error = NULL; FridaScript * handle; - if (!PyArg_ParseTupleAndKeywords (args, kw, "s|s", keywords, &source, &name)) + if (!PyArg_ParseTupleAndKeywords (args, kw, "es|es", keywords, "utf-8", &source, "utf-8", &name)) return NULL; Py_BEGIN_ALLOW_THREADS handle = frida_session_create_script_sync (self->handle, name, source, &error); Py_END_ALLOW_THREADS + + PyMem_Free (source); + PyMem_Free (name); + if (error != NULL) return PyFrida_raise (error);