diff --git a/include/boost/python/object/make_ptr_instance.hpp b/include/boost/python/object/make_ptr_instance.hpp index 88e50650..6bb4b61d 100644 --- a/include/boost/python/object/make_ptr_instance.hpp +++ b/include/boost/python/object/make_ptr_instance.hpp @@ -49,19 +49,15 @@ struct make_ptr_instance template static inline PyTypeObject* get_derived_class_object(mpl::true_, U const volatile* x) { - converter::registration const* r = converter::registry::query(type_info(typeid(*x))); + converter::registration const* r = converter::registry::query( + type_info(typeid(*get_pointer(x))) + ); return r ? r->m_class_object : 0; } template - static inline PyTypeObject* get_derived_class_object(mpl::false_, U* x) + static inline PyTypeObject* get_derived_class_object(mpl::false_, U*) { -# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - if (typeid(*x) != typeid(U)) - return get_derived_class_object(mpl::true_(), x); -# else - (void)x; -# endif return 0; } }; diff --git a/include/boost/python/object/pointer_holder.hpp b/include/boost/python/object/pointer_holder.hpp index ea4c7614..8033c2e6 100644 --- a/include/boost/python/object/pointer_holder.hpp +++ b/include/boost/python/object/pointer_holder.hpp @@ -104,11 +104,11 @@ void* pointer_holder::holds(type_info dst_t) if (dst_t == python::type_id()) return &this->m_p; - if (get_pointer(this->m_p) == 0) + Value* p = get_pointer(this->m_p); + if (p == 0) return 0; type_info src_t = python::type_id(); - Value* p = &*this->m_p; return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); } @@ -121,11 +121,12 @@ void* pointer_holder_back_reference::holds(type_info dst_t) if (!get_pointer(this->m_p)) return 0; + Value* p = get_pointer(m_p); + if (dst_t == python::type_id()) - return &*this->m_p; + return p; type_info src_t = python::type_id(); - Value* p = &*this->m_p; return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); }