Python 3.7 support: Remove use of deprecated PyUnicode_GetSize

This commit is contained in:
William S Fulton 2018-06-15 19:34:36 +01:00
commit 1665712fcb
2 changed files with 9 additions and 1 deletions

View file

@ -29,7 +29,11 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc)
}
%#endif
if (isunicode) {
%#if PY_VERSION_HEX >= 0x03030000
Py_ssize_t len = PyUnicode_GetLength(obj);
%#else
Py_ssize_t len = PyUnicode_GetSize(obj);
%#endif
if (cptr) {
Py_ssize_t length;
*cptr = %new_array(len + 1, wchar_t);