@@ -109,14 +109,17 @@ int SimpleStringFull(char *command, double* result) {
109
109
return ZF_SUCCESS ;
110
110
}
111
111
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 ) {
114
116
115
117
if (isInitialized == false) {
116
118
Initialize ();
117
119
}
118
120
119
- PyRun_SimpleString (command );
121
+ PyRun_SimpleString ((char * )command -> str .ch );
122
+ CACHEEXSTRKILL (command );
120
123
121
124
int exists = PyObject_HasAttrString (mainModule , resultVar );
122
125
@@ -132,8 +135,6 @@ int SimpleString(char *command, char *resultVar, int serialization, CACHE_EXSTRP
132
135
133
136
char * str = PyUnicode_AsUTF8 (varStr );
134
137
135
- //sprintf(result, "%s", str);
136
-
137
138
int len = strlen (str );
138
139
CACHEEXSTRKILL (result );
139
140
if (!CACHEEXSTRNEW (result ,len )) {
@@ -173,5 +174,5 @@ ZFBEGIN
173
174
ZFENTRY ("GetRandom" ,"D" ,GetRandom )
174
175
ZFENTRY ("GetRandomSimple" ,"D" ,GetRandomSimple )
175
176
ZFENTRY ("SimpleStringFull" ,"cD" ,SimpleStringFull )
176
- ZFENTRY ("SimpleString" ,"cciJ " ,SimpleString )
177
+ ZFENTRY ("SimpleString" ,"jciJ " ,SimpleString )
177
178
ZFEND
0 commit comments