Update everything for dropping Python 3.2 support
This commit is contained in:
parent
a55d40dbb5
commit
0b9d4eff09
7 changed files with 9 additions and 36 deletions
|
|
@ -30,38 +30,19 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* Warning: This function will allocate a new string in Python 3,
|
||||
* so please call SWIG_Python_str_DelForPy3(x) to free the space.
|
||||
*/
|
||||
SWIGINTERN char*
|
||||
SWIG_Python_str_AsChar(PyObject *str)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03030000
|
||||
return (char *)PyUnicode_AsUTF8(str);
|
||||
#elif PY_VERSION_HEX >= 0x03000000
|
||||
char *newstr = 0;
|
||||
str = PyUnicode_AsUTF8String(str);
|
||||
if (str) {
|
||||
char *cstr;
|
||||
Py_ssize_t len;
|
||||
if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) {
|
||||
newstr = (char *) malloc(len+1);
|
||||
if (newstr)
|
||||
memcpy(newstr, cstr, len+1);
|
||||
}
|
||||
Py_XDECREF(str);
|
||||
}
|
||||
return newstr;
|
||||
#else
|
||||
return PyString_AsString(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000
|
||||
# define SWIG_Python_str_DelForPy3(x)
|
||||
#else
|
||||
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
|
||||
#endif
|
||||
/* Was useful for Python 3.0.x-3.2.x - now provided only for compatibility
|
||||
* with any uses in user interface files. */
|
||||
#define SWIG_Python_str_DelForPy3(x)
|
||||
|
||||
|
||||
SWIGINTERN PyObject*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue