aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-10-04 16:05:24 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:18:18 -0300
commit3de584066e350e4b8cf269e5a3729a0d319f9ce3 (patch)
treeda4610c2f76cc6d8cccefdbeb1ec783114623ccd
parent0d2b0a21ed96719ad45e5bf9da799aef71863f48 (diff)
Replaced use of PyBytes_AS_STRING to Shiboken::String functions.
-rw-r--r--libshiboken/helper.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/libshiboken/helper.cpp b/libshiboken/helper.cpp
index 4a7df66cd..cbb41e8f1 100644
--- a/libshiboken/helper.cpp
+++ b/libshiboken/helper.cpp
@@ -54,16 +54,13 @@ bool sequenceToArgcArgv(PyObject* argList, int* argc, char*** argv, const char*
// Try to get the script name
PyObject* globals = PyEval_GetGlobals();
PyObject* appName = PyDict_GetItemString(globals, "__file__");
- (*argv)[0] = strdup(appName ? PyBytes_AS_STRING(appName) : defaultAppName);
+ (*argv)[0] = strdup(appName ? Shiboken::String::toCString(appName) : defaultAppName);
} else {
for (int i = 0; i < numArgs; ++i) {
PyObject* item = PySequence_Fast_GET_ITEM(args.object(), i);
char* string;
- if (PyUnicode_Check(item)) {
- Shiboken::AutoDecRef utf8(PyUnicode_AsUTF8String(item));
- string = strdup(PyBytes_AS_STRING(utf8.object()));
- } else {
- string = strdup(PyBytes_AS_STRING(item));
+ if (Shiboken::String::check(item)) {
+ string = strdup(Shiboken::String::toCString(item));
}
(*argv)[i] = string;
}