Warning: This function will allocate a new string in Python 3, * so please call SWIG_Python_str_DelForPy3(x) to free the space. */
| 786 | * so please call SWIG_Python_str_DelForPy3(x) to free the space. |
| 787 | */ |
| 788 | SWIGINTERN char* |
| 789 | SWIG_Python_str_AsChar(PyObject *str) |
| 790 | { |
| 791 | #if PY_VERSION_HEX >= 0x03000000 |
| 792 | char *cstr; |
| 793 | char *newstr; |
| 794 | Py_ssize_t len; |
| 795 | str = PyUnicode_AsUTF8String(str); |
| 796 | PyBytes_AsStringAndSize(str, &cstr, &len); |
| 797 | newstr = (char *) malloc(len+1); |
| 798 | memcpy(newstr, cstr, len+1); |
| 799 | Py_XDECREF(str); |
| 800 | return newstr; |
| 801 | #else |
| 802 | return PyString_AsString(str); |
| 803 | #endif |
| 804 | } |
| 805 | |
| 806 | #if PY_VERSION_HEX >= 0x03000000 |
| 807 | # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) |
no outgoing calls
no test coverage detected