summaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-10-05 19:32:46 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2011-10-06 17:04:20 -0300
commit7a15e5cf60f17aa7123703b79a51d6b93b1227f5 (patch)
tree494d690117eb1775d2325c2080dd99d240560a57 /libshiboken
parentd24dc4c9405c3aab4421361322cdd30a81eb5b9a (diff)
downloadshiboken-7a15e5cf60f17aa7123703b79a51d6b93b1227f5.tar.gz
shiboken-7a15e5cf60f17aa7123703b79a51d6b93b1227f5.tar.xz
shiboken-7a15e5cf60f17aa7123703b79a51d6b93b1227f5.zip
Fixed shiboken buffer to work with python 3.x
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/shibokenbuffer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libshiboken/shibokenbuffer.cpp b/libshiboken/shibokenbuffer.cpp
index 18ddd861..ed9e7096 100644
--- a/libshiboken/shibokenbuffer.cpp
+++ b/libshiboken/shibokenbuffer.cpp
@@ -35,6 +35,8 @@ void* Shiboken::Buffer::getPointer(PyObject* pyObj, Py_ssize_t* size)
#ifdef IS_PY3K
Py_buffer view;
if (PyObject_GetBuffer(pyObj, &view, PyBUF_ND) == 0) {
+ if (size)
+ *size = view.len;
return view.buf;
} else {
return 0;
@@ -53,6 +55,8 @@ void* Shiboken::Buffer::getPointer(PyObject* pyObj, Py_ssize_t* size)
PyObject* Shiboken::Buffer::newObject(void* memory, Py_ssize_t size, Type type)
{
+ if (size == 0)
+ Py_RETURN_NONE;
#ifdef IS_PY3K
Py_buffer view;
memset(&view, 0, sizeof(Py_buffer));