diff --git a/Lib/python/boost_shared_ptr.i b/Lib/python/boost_shared_ptr.i index bae1576c2..100ed3e82 100644 --- a/Lib/python/boost_shared_ptr.i +++ b/Lib/python/boost_shared_ptr.i @@ -318,14 +318,5 @@ %template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; -#if defined(SWIGPYTHON_BUILTIN) - -%typemap(builtin_init, fragment="SWIG_null_deleter_python") CONST TYPE * { - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0; - %set_output(SWIG_Python_NewBuiltinObj(self, %as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), $owner | SWIG_POINTER_OWN)); -} - -#endif - %enddef diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg index 8d48fa0b3..ccd566bc1 100644 --- a/Lib/python/pyinit.swg +++ b/Lib/python/pyinit.swg @@ -388,7 +388,7 @@ SWIG_init(void) { /* All objects have a 'this' attribute */ static PyGetSetDef this_getset_def = { - (char*) "this", SwigPyBuiltin_ThisClosure, NULL, NULL, NULL + (char *)"this", SwigPyBuiltin_ThisClosure, NULL, NULL, NULL }; PyObject *this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); @@ -398,7 +398,7 @@ SWIG_init(void) { (PyCFunction) SwigPyObject_own }; static PyGetSetDef thisown_getset_def = { - const_cast("thisown"), SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure + (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure }; PyObject *thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); diff --git a/Lib/python/pytypemaps.swg b/Lib/python/pytypemaps.swg index c47a2ee93..c64b47b05 100644 --- a/Lib/python/pytypemaps.swg +++ b/Lib/python/pytypemaps.swg @@ -88,12 +88,6 @@ $result = SWIG_NewPointerObj(%new_copy(*$1, $*ltype), $descriptor, SWIG_POINTER_OWN | %newpointer_flags); } -/* -%typemap(builtin_init,noblock=1) const SWIGTYPE & SMARTPOINTER { - $result = SWIG_NewBuiltinObj(self, %new_copy(*$1, $*ltype), $descriptor, SWIG_POINTER_OWN | %newpointer_flags); -} -*/ - %typemap(ret,noblock=1) const SWIGTYPE & SMARTPOINTER, SWIGTYPE SMARTPOINTER { if ($result) { PyObject *robj = PyObject_CallMethod($result, (char *)"__deref__", NULL); @@ -105,24 +99,3 @@ } } -/* ------------------------------------------------------------- - * Output typemap for the __init__ method of a built-in type. - * ------------------------------------------------------------ */ - -/* Pointers, references */ -/* -%typemap(builtin_init,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE[] { - %set_output(SWIG_Python_NewBuiltinObj(self, %as_voidptr($1), $descriptor, $owner | %newpointer_flags)); -} -*/ -/* -%typemap(builtin_init, noblock=1) SWIGTYPE *const& { - %set_output(SWIG_Python_NewBuiltinObj(self, %as_voidptr(*$1), $*descriptor, $owner | %newpointer_flags)); -} -*/ -/* Return by value */ -/* -%typemap(builtin_init, noblock=1) SWIGTYPE { - %set_output(SWIG_Python_NewBuiltinObj(self, %new_copy($1, $ltype), $&descriptor, $owner | %newpointer_flags)); -} -*/ diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 0d77f1ccd..e16265c99 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -171,14 +171,14 @@ static String *getSlot(Node *n = NULL, const char *key = NULL) { return val ? val : slot_default; } -static void printSlot (File *f, DOH const *slotval, DOH const *slotname, DOH const *functype = NULL, bool comma=true) { - if (functype) - slotval = NewStringf("(%s) %s", functype, slotval); +static void printSlot(File *f, const String *slotval, const char *slotname, const char *functype = NULL, bool comma=true) { + String *slotval_override = functype ? NewStringf("(%s) %s", functype, slotval) : 0; + if (slotval_override) + slotval = slotval_override; int len = Len(slotval); int fieldwidth = len > 40 ? 0 : 40 - len; Printf(f, " %s%s%*s/* %s */\n", slotval, comma ? "," : "", fieldwidth, "", slotname); - if (functype) - Delete((DOH*) slotval); + Delete(slotval_override); } static String *getClosure(String *functype, String *wrapper, int funpack = 0) {