aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/interfaces/python/typemaps/python.buffer.intm7
1 files changed, 4 insertions, 3 deletions
diff --git a/xbmc/interfaces/python/typemaps/python.buffer.intm b/xbmc/interfaces/python/typemaps/python.buffer.intm
index 76c09cb783..57f350d81f 100644
--- a/xbmc/interfaces/python/typemaps/python.buffer.intm
+++ b/xbmc/interfaces/python/typemaps/python.buffer.intm
@@ -9,10 +9,11 @@
%>
if (PyUnicode_Check(${slarg}))
{
- const char* str = PyUnicode_AsUTF8(${slarg});
- size_t size = (size_t)PyUnicode_GetLength(${slarg});
+ Py_ssize_t pysize;
+ const char* str = PyUnicode_AsUTF8AndSize(${slarg}, &pysize);
+ size_t size = static_cast<size_t>(pysize);
${api}.allocate(size);
- ${api}.put(str,size);
+ ${api}.put(str, size);
${api}.flip(); // prepare the buffer for reading from
}
else if (PyByteArray_Check(${slarg}))