summaryrefslogtreecommitdiff
path: root/boost/python/converter/pyobject_type.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/python/converter/pyobject_type.hpp')
-rw-r--r--boost/python/converter/pyobject_type.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/boost/python/converter/pyobject_type.hpp b/boost/python/converter/pyobject_type.hpp
index 526f9f9dba..bde39e8057 100644
--- a/boost/python/converter/pyobject_type.hpp
+++ b/boost/python/converter/pyobject_type.hpp
@@ -9,8 +9,11 @@
namespace boost { namespace python { namespace converter {
-BOOST_PYTHON_DECL PyObject* checked_downcast_impl(PyObject*, PyTypeObject*);
-
+BOOST_PYTHON_DECL inline
+PyObject* checked_downcast_impl(PyObject *obj, PyTypeObject *type)
+{
+ return (PyType_IsSubtype(Py_TYPE(obj), type) ? obj : NULL);
+}
// Used as a base class for specializations which need to provide
// Python type checking capability.
template <class Object, PyTypeObject* pytype>