From bde299cc9d3bebf64a8eeed7ae887a1d7e7a053c Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Fri, 4 Feb 2000 04:22:52 +0000 Subject: [PATCH] Make the use of CObjects a conditional compilation flag. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@191 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/python/python.swg | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SWIG/Lib/python/python.swg b/SWIG/Lib/python/python.swg index 61c51b2db..ca8242d38 100644 --- a/SWIG/Lib/python/python.swg +++ b/SWIG/Lib/python/python.swg @@ -256,6 +256,7 @@ SWIG_ConvertPtr(PyObject *obj, void **ptr, _swig_type_info *ty) { *ptr = 0; return 0; } +#ifdef SWIG_COBJECT_TYPES if (!(PyCObject_Check(obj))) { if (!SWIG_this) SWIG_this = PyString_InternFromString("this"); @@ -265,8 +266,7 @@ SWIG_ConvertPtr(PyObject *obj, void **ptr, _swig_type_info *ty) { *ptr = PyCObject_AsVoidPtr(obj); c = (char *) PyCObject_GetDesc(obj); goto cobject; - -#ifdef SWIG_STRING_TYPES +#else if (!(PyString_Check(obj))) { if (!SWIG_this) SWIG_this = PyString_InternFromString("this"); @@ -350,9 +350,12 @@ SWIG_NewPointerObj(void *ptr, _swig_type_info *type) { Py_INCREF(Py_None); return Py_None; } - /* SWIG_MakePtr(result,ptr,type); - robj = PyString_FromString(result);*/ +#ifdef SWIG_COBJECT_TYPES robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, type->name, NULL); +#else + SWIG_MakePtr(result,ptr,type); + robj = PyString_FromString(result); +#endif return robj; }