Merge pull request #1716 from ZackerySpytz/Python-utf8-cache
Use PyUnicode_AsUTF8() for Python >= 3.3
This commit is contained in:
commit
02e967d05d
1 changed files with 6 additions and 4 deletions
|
|
@ -37,7 +37,9 @@
|
|||
SWIGINTERN char*
|
||||
SWIG_Python_str_AsChar(PyObject *str)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
#if PY_VERSION_HEX >= 0x03030000
|
||||
return (char *)PyUnicode_AsUTF8(str);
|
||||
#elif PY_VERSION_HEX >= 0x03000000
|
||||
char *newstr = 0;
|
||||
str = PyUnicode_AsUTF8String(str);
|
||||
if (str) {
|
||||
|
|
@ -56,10 +58,10 @@ SWIG_Python_str_AsChar(PyObject *str)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
|
||||
#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000
|
||||
# define SWIG_Python_str_DelForPy3(x)
|
||||
#else
|
||||
# define SWIG_Python_str_DelForPy3(x)
|
||||
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue