Skip to content

Commit 4832185

Browse files
committed
consistent use of get_pointer
[SVN r21326]
1 parent 156da15 commit 4832185

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

include/boost/python/object/make_ptr_instance.hpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,15 @@ struct make_ptr_instance
4949
template <class U>
5050
static inline PyTypeObject* get_derived_class_object(mpl::true_, U const volatile* x)
5151
{
52-
converter::registration const* r = converter::registry::query(type_info(typeid(*x)));
52+
converter::registration const* r = converter::registry::query(
53+
type_info(typeid(*get_pointer(x)))
54+
);
5355
return r ? r->m_class_object : 0;
5456
}
5557

5658
template <class U>
57-
static inline PyTypeObject* get_derived_class_object(mpl::false_, U* x)
59+
static inline PyTypeObject* get_derived_class_object(mpl::false_, U*)
5860
{
59-
# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
60-
if (typeid(*x) != typeid(U))
61-
return get_derived_class_object(mpl::true_(), x);
62-
# else
63-
(void)x;
64-
# endif
6561
return 0;
6662
}
6763
};

include/boost/python/object/pointer_holder.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ void* pointer_holder<Pointer, Value>::holds(type_info dst_t)
104104
if (dst_t == python::type_id<Pointer>())
105105
return &this->m_p;
106106

107-
if (get_pointer(this->m_p) == 0)
107+
Value* p = get_pointer(this->m_p);
108+
if (p == 0)
108109
return 0;
109110

110111
type_info src_t = python::type_id<Value>();
111-
Value* p = &*this->m_p;
112112
return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t);
113113
}
114114

@@ -121,11 +121,12 @@ void* pointer_holder_back_reference<Pointer, Value>::holds(type_info dst_t)
121121
if (!get_pointer(this->m_p))
122122
return 0;
123123

124+
Value* p = get_pointer(m_p);
125+
124126
if (dst_t == python::type_id<held_type>())
125-
return &*this->m_p;
127+
return p;
126128

127129
type_info src_t = python::type_id<Value>();
128-
Value* p = &*this->m_p;
129130
return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t);
130131
}
131132

0 commit comments

Comments
 (0)