summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 32139f6..92b971f 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -563,18 +563,22 @@ Py_Main(int argc, wchar_t **argv)
}
if (command) {
+ char *commandStr;
PyObject *commandObj = PyUnicode_FromWideChar(
command, wcslen(command));
free(command);
- if (commandObj != NULL) {
- sts = PyRun_SimpleStringFlags(
- _PyUnicode_AsString(commandObj), &cf) != 0;
+ if (commandObj != NULL)
+ commandStr = _PyUnicode_AsString(commandObj);
+ else
+ commandStr = NULL;
+ if (commandStr != NULL) {
+ sts = PyRun_SimpleStringFlags(commandStr, &cf) != 0;
+ Py_DECREF(commandObj);
}
else {
PyErr_Print();
sts = 1;
}
- Py_DECREF(commandObj);
} else if (module) {
sts = RunModule(module, 1);
}