aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-11-24 19:28:00 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-11-24 20:10:05 -0300
commita7ad5fdfc6cef168d538605ee0dec0e14f55f7d1 (patch)
tree82758e57c91efee1e447d716a004caeba5e7a923 /libshiboken
parentb8db6d3d44eb4e7bdb1e680acb51b91dba64bbc6 (diff)
Added an PyObject* specialization to the Conversion template to
avoid problems when converting PyObjects to C++. Tests where also added for this. Reviewed by Lauro Neto <lauro.neto@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/conversions.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/libshiboken/conversions.h b/libshiboken/conversions.h
index 9c3330432..b69d0bbae 100644
--- a/libshiboken/conversions.h
+++ b/libshiboken/conversions.h
@@ -113,6 +113,14 @@ struct Converter<T*> : Converter<T>
};
template <typename T> struct Converter<const T*> : Converter<T*> {};
+// PyObject* specialization to avoid converting what doesn't need to be converted.
+template<>
+struct Converter<PyObject*> : ConverterBase<PyObject*>
+{
+ inline static PyObject* toCpp(PyObject* pyobj) { return pyobj; }
+};
+template <> struct Converter<const PyObject*> : Converter<PyObject*> {};
+
// Reference Conversions
template <typename T>
struct Converter<T&> : Converter<T*>