Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */
| 807 | * so please call SWIG_Python_str_DelForPy3(x) to free the space. |
| 808 | */ |
| 809 | SWIGINTERN char* |
| 810 | SWIG_Python_str_AsChar(PyObject *str) |
| 811 | { |
| 812 | #if PY_VERSION_HEX >= 0x03000000 |
| 813 | char *newstr = 0; |
| 814 | str = PyUnicode_AsUTF8String(str); |
| 815 | if (str) { |
| 816 | char *cstr; |
| 817 | Py_ssize_t len; |
| 818 | PyBytes_AsStringAndSize(str, &cstr, &len); |
| 819 | newstr = (char *) malloc(len+1); |
| 820 | memcpy(newstr, cstr, len+1); |
| 821 | Py_XDECREF(str); |
| 822 | } |
| 823 | return newstr; |
| 824 | #else |
| 825 | return PyString_AsString(str); |
| 826 | #endif |
| 827 | } |
| 828 | |
| 829 | #if PY_VERSION_HEX >= 0x03000000 |
| 830 | # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) |
no outgoing calls
no test coverage detected