@@ -109,14 +109,17 @@ int SimpleStringFull(char *command, double* result) {
109109 return ZF_SUCCESS ;
110110}
111111
112- // Assumes initialized environment
113- int SimpleString (char * command , char * resultVar , int serialization , CACHE_EXSTRP result ) {
112+ // Execute simple command.
113+ // Initializes environment if required
114+ // Does not finalize the environment.
115+ int SimpleString (CACHE_EXSTRP command , char * resultVar , int serialization , CACHE_EXSTRP result ) {
114116
115117 if (isInitialized == false) {
116118 Initialize ();
117119 }
118120
119- PyRun_SimpleString (command );
121+ PyRun_SimpleString ((char * )command -> str .ch );
122+ CACHEEXSTRKILL (command );
120123
121124 int exists = PyObject_HasAttrString (mainModule , resultVar );
122125
@@ -132,8 +135,6 @@ int SimpleString(char *command, char *resultVar, int serialization, CACHE_EXSTRP
132135
133136 char * str = PyUnicode_AsUTF8 (varStr );
134137
135- //sprintf(result, "%s", str);
136-
137138 int len = strlen (str );
138139 CACHEEXSTRKILL (result );
139140 if (!CACHEEXSTRNEW (result ,len )) {
@@ -173,5 +174,5 @@ ZFBEGIN
173174 ZFENTRY ("GetRandom" ,"D" ,GetRandom )
174175 ZFENTRY ("GetRandomSimple" ,"D" ,GetRandomSimple )
175176 ZFENTRY ("SimpleStringFull" ,"cD" ,SimpleStringFull )
176- ZFENTRY ("SimpleString" ,"cciJ " ,SimpleString )
177+ ZFENTRY ("SimpleString" ,"jciJ " ,SimpleString )
177178ZFEND
0 commit comments