| 230 | } |
| 231 | |
| 232 | const char * |
| 233 | PythonModule::getString() { |
| 234 | if (wrapper.getCurrentArg() >= wrapper.getNumberArgs()) { |
| 235 | return 0; |
| 236 | } |
| 237 | |
| 238 | PyObject *o = PyTuple_GetItem(wrapper.getCurrentArgv(), wrapper.getCurrentArg()); |
| 239 | wrapper.incrCurrentArg(); |
| 240 | #if PY_MAJOR_VERSION >= 3 |
| 241 | if (!PyUnicode_Check(o)) { |
| 242 | return 0; |
| 243 | } |
| 244 | |
| 245 | // PyObject* space = PyUnicode_FromString(" "); |
| 246 | // PyObject* empty = PyUnicode_FromString(""); |
| 247 | // PyObject* newo = PyUnicode_Replace(o, space, empty, -1); |
| 248 | const char* res = trimSpaces(o); |
| 249 | // Py_DECREF(newo); |
| 250 | // Py_DECREF(space); |
| 251 | // Py_DECREF(empty); |
| 252 | |
| 253 | return res; |
| 254 | #else |
| 255 | if (!PyString_Check(o)) { |
| 256 | return 0; |
| 257 | } |
| 258 | |
| 259 | return PyString_AS_STRING(o); |
| 260 | #endif |
| 261 | } |
| 262 | |
| 263 | const char *PythonModule::getStringFromAll(char* buffer, int len) { |
| 264 | if (wrapper.getCurrentArg() >= wrapper.getNumberArgs()) { |
no test coverage detected