aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-08-03 10:57:05 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-08-03 11:07:25 -0300
commitb7e7ac6f77e1128a16c5556baffd5e9b94df74c4 (patch)
treed57f06624f34a23efd93bf48b3c2e646c001e909 /libshiboken
parent02503b1952b4c0558081206e31e92ad43886f9b5 (diff)
Modified the void* converter to deal with all pointers as coming from Python.
This is the common case, for the situation when C++ returns a never before seen void pointer it'll be necessary to write custom code to deal with the result.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/conversions.h19
1 files changed, 5 insertions, 14 deletions
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h
index 4c3ebb5b8..6247c55d8 100644
--- a/libshiboken/conversions.h
+++ b/libshiboken/conversions.h
@@ -186,7 +186,7 @@ struct Converter<const T&> : Converter<T&>
static inline PyObject* toPython(const T& cppobj)
{
T* cpy = CppObjectCopier<T>::copy(cppobj);
- return createWrapper<T>(cpy);
+ return createWrapper<T>(cpy);
}
};
@@ -200,20 +200,11 @@ struct Converter<void*>
{
if (!cppobj)
Py_RETURN_NONE;
- PyObject* pyobj = BindingManager::instance().retrieveWrapper(cppobj);
- if (pyobj)
- Py_INCREF(pyobj);
- else
- pyobj = SbkBaseWrapper_New(&SbkBaseWrapper_Type, cppobj, false, false);
- return pyobj;
- }
- static void* toCpp(PyObject* pyobj)
- {
- if (pyobj == Py_None)
- return 0;
- // When someone request a void pointer, just give to him the first C++ object in the class hierarchy
- return reinterpret_cast<SbkBaseWrapper*>(pyobj)->cptr;
+ PyObject* result = (PyObject*) cppobj;
+ Py_INCREF(result);
+ return result;
}
+ static void* toCpp(PyObject* pyobj) { return pyobj; }
};
template <> struct Converter<const void*> : Converter<void*> {};