diff --git a/include/boost/python/object/value_holder.hpp b/include/boost/python/object/value_holder.hpp index 3543d61b..e722d6b6 100644 --- a/include/boost/python/object/value_holder.hpp +++ b/include/boost/python/object/value_holder.hpp @@ -91,16 +91,14 @@ void* value_holder_back_reference::holds( type_info dst_t) { type_info src_t = python::type_id(); - if (src_t == dst_t) - { - Held* x = &m_held; + Held* x = &m_held; + + if (dst_t == src_t) return x; - } - - src_t = python::type_id(); - return src_t == dst_t - ? &m_held - : find_static_type(&m_held, src_t, dst_t); + else if (dst_t == python::type_id()) + return &m_held; + else + return find_static_type(x, src_t, dst_t); } }}} // namespace boost::python::objects