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:16:45 +0300
commit9b234a4266cd72c28cd58602896756c000cf918d (patch)
tree9390ee8810538b344e73e4f5a4d9db5f6bb3485e
parenta1f36bb0738d7f9f3fc60e37b15386cf50caec11 (diff)
Elm: Fix module init from embedded interpreter
sys.argv doesn't exist there
-rw-r--r--efl/elementary/__init__.pyx26
1 files changed, 13 insertions, 13 deletions
diff --git a/efl/elementary/__init__.pyx b/efl/elementary/__init__.pyx
index c4137da..9a2a602 100644
--- a/efl/elementary/__init__.pyx
+++ b/efl/elementary/__init__.pyx
@@ -113,20 +113,20 @@ def init():
113 # FIXME: Why are we passing the cl args to elm_init here? 113 # FIXME: Why are we passing the cl args to elm_init here?
114 114
115 cdef: 115 cdef:
116 int argc, i, arg_len 116 int argc = 0, i, arg_len
117 char **argv 117 char **argv = NULL
118 char *arg 118 char *arg
119 int ret 119
120 120 if hasattr(sys, "argv"):
121 argc = len(sys.argv) 121 argc = len(sys.argv)
122 argv = <char **>PyMem_Malloc(argc * sizeof(char *)) 122 argv = <char **>PyMem_Malloc(argc * sizeof(char *))
123 for i in range(argc): 123 for i in range(argc):
124 t = sys.argv[i] 124 t = sys.argv[i]
125 if isinstance(t, unicode): t = PyUnicode_AsUTF8String(t) 125 if isinstance(t, unicode): t = PyUnicode_AsUTF8String(t)
126 arg = t 126 arg = t
127 arg_len = len(arg) 127 arg_len = len(arg)
128 argv[i] = <char *>PyMem_Malloc(arg_len + 1) 128 argv[i] = <char *>PyMem_Malloc(arg_len + 1)
129 memcpy(argv[i], arg, arg_len + 1) 129 memcpy(argv[i], arg, arg_len + 1)
130 130
131 return elm_init(argc, argv) 131 return elm_init(argc, argv)
132 132