summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2015-05-09 20:16:45 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2015-05-09 20:19:35 +0300
commit73938af391e61985c8fa687cb571bf8cd759f4d5 (patch)
treef403029c8a3d33c58afce2eefacb2c6b27cb320c
parent1011cb76df9adf516be79426bbee298eb962ae3e (diff)
Elm: Fix module init from embedded interpreterpython-efl-1.14
sys.argv doesn't exist there
-rw-r--r--efl/elementary/general.pyx26
1 files changed, 13 insertions, 13 deletions
diff --git a/efl/elementary/general.pyx b/efl/elementary/general.pyx
index f449785..3584b7c 100644
--- a/efl/elementary/general.pyx
+++ b/efl/elementary/general.pyx
@@ -366,20 +366,20 @@ def init():
366 # FIXME: Why are we passing the cl args to elm_init here? 366 # FIXME: Why are we passing the cl args to elm_init here?
367 367
368 cdef: 368 cdef:
369 int argc, i, arg_len 369 int argc = 0, i, arg_len
370 char **argv 370 char **argv = NULL
371 char *arg 371 char *arg
372 int ret 372
373 373 if hasattr(sys, "argv"):
374 argc = len(sys.argv) 374 argc = len(sys.argv)
375 argv = <char **>PyMem_Malloc(argc * sizeof(char *)) 375 argv = <char **>PyMem_Malloc(argc * sizeof(char *))
376 for i in range(argc): 376 for i in range(argc):
377 t = sys.argv[i] 377 t = sys.argv[i]
378 if isinstance(t, unicode): t = PyUnicode_AsUTF8String(t) 378 if isinstance(t, unicode): t = PyUnicode_AsUTF8String(t)
379 arg = t 379 arg = t
380 arg_len = len(arg) 380 arg_len = len(arg)
381 argv[i] = <char *>PyMem_Malloc(arg_len + 1) 381 argv[i] = <char *>PyMem_Malloc(arg_len + 1)
382 memcpy(argv[i], arg, arg_len + 1) 382 memcpy(argv[i], arg, arg_len + 1)
383 383
384 return elm_init(argc, argv) 384 return elm_init(argc, argv)
385 385