diff --git a/CHANGES.current b/CHANGES.current index c9aaecb62..9fb57f9f0 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -16,8 +16,12 @@ Version 4.0.0 (in progress) instring(b"h\xe9llooo") # Python +2018-06-15: wsfulton + [Python] Python 3.7 support: Replace use of deprecated PyUnicode_GetSize with + PyUnicode_GetLength to remove deprecated warnings compiling the C/C++ wrappers. + 2018-06-12: wsfulton - [Python] The %pythonabc feature in pyabc.i now uses base classes + [Python] Python 3.7 support: The %pythonabc feature in pyabc.i now uses base classes collections.abc.MutableSequence collections.abc.MutableMapping collections.abc.MutableSet diff --git a/Lib/python/pywstrings.swg b/Lib/python/pywstrings.swg index a3b1f4f69..0e5a78df5 100644 --- a/Lib/python/pywstrings.swg +++ b/Lib/python/pywstrings.swg @@ -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);