From 074d2e0449453c9786f2a6431b4d48ceb429ca15 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 29 Aug 2006 18:56:07 +0000 Subject: [PATCH] Use PyObject_AsReadBuffer in the typemap for getting buffer or buffer compatible objects git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40911 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/my_typemaps.i | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/wxPython/src/my_typemaps.i b/wxPython/src/my_typemaps.i index 5c8474ef2b..369de3f95d 100644 --- a/wxPython/src/my_typemaps.i +++ b/wxPython/src/my_typemaps.i @@ -319,16 +319,19 @@ MAKE_INT_ARRAY_TYPEMAPS(styles, styles_field) // Typemaps for loading a image or bitmap from an object that implements the // buffer interface - %typemap(in) (buffer data, int DATASIZE) -{ if ($input != Py_None) { - if (!PyArg_Parse($input, "t#", &$1, &$2)) SWIG_fail; -}} +{ + if (PyObject_AsReadBuffer($input, (const void**)(&$1), &$2) == -1) SWIG_fail; +} %typemap(in) (buffer alpha, int ALPHASIZE) -{ if ($input != Py_None) { - if (!PyArg_Parse($input, "t#", &$1, &$2)) SWIG_fail; -}} +{ + if ($input != Py_None) { + if (PyObject_AsReadBuffer($input, (const void**)(&$1), &$2) == -1) SWIG_fail; + } +} + + //--------------------------------------------------------------------------- // Typemaps to convert return values that are base class pointers -- 2.50.0