mirror of
https://github.com/boostorg/python.git
synced 2026-01-20 16:52:15 +00:00
Better error reporting
[SVN r14448]
This commit is contained in:
@@ -180,13 +180,13 @@ namespace detail
|
||||
|
||||
template <class T>
|
||||
inline value_arg_to_python<T>::value_arg_to_python(T const& x)
|
||||
: arg_to_python_base(&x, registered<T>::converters.to_python)
|
||||
: arg_to_python_base(&x, registered<T>::converters)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Ptr>
|
||||
inline pointer_deep_arg_to_python<Ptr>::pointer_deep_arg_to_python(Ptr x)
|
||||
: arg_to_python_base(x, registered_pointee<Ptr>::converters.to_python)
|
||||
: arg_to_python_base(x, registered_pointee<Ptr>::converters)
|
||||
{
|
||||
detail::reject_raw_object_ptr((Ptr)0);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace boost { namespace python { namespace converter {
|
||||
|
||||
struct registration;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct BOOST_PYTHON_DECL arg_to_python_base
|
||||
@@ -18,7 +20,7 @@ namespace detail
|
||||
: handle<>
|
||||
# endif
|
||||
{
|
||||
arg_to_python_base(void const volatile* source, to_python_function_t);
|
||||
arg_to_python_base(void const volatile* source, registration const&);
|
||||
# if defined(BOOST_MSVC) && BOOST_MSVC > 1300 && _MSC_FULL_VER <= 13102171
|
||||
PyObject* get() const { return m_ptr.get(); }
|
||||
PyObject* release() { return m_ptr.release(); }
|
||||
|
||||
@@ -19,28 +19,32 @@ namespace detail
|
||||
|
||||
namespace
|
||||
{
|
||||
inline PyObject* convert_to_python(void const volatile* source, to_python_function_t converter)
|
||||
inline PyObject* convert_to_python(void const volatile* source, registration const& converters)
|
||||
{
|
||||
if (converter == 0)
|
||||
if (converters.to_python == 0)
|
||||
{
|
||||
PyErr_SetString(
|
||||
|
||||
PyErr_SetObject(
|
||||
PyExc_TypeError
|
||||
, const_cast<char*>("no to_python (by-value) converter found for type"));
|
||||
, (object("no to_python (by-value) converter found for C++ type: ")
|
||||
+ converters.target_type.name()).ptr()
|
||||
);
|
||||
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
return source == 0
|
||||
? python::detail::none()
|
||||
: converter(const_cast<void*>(source));
|
||||
: converters.to_python(const_cast<void*>(source));
|
||||
}
|
||||
}
|
||||
|
||||
arg_to_python_base::arg_to_python_base(
|
||||
void const volatile* source, to_python_function_t converter)
|
||||
void const volatile* source, registration const& converters)
|
||||
# if !defined(BOOST_MSVC) || _MSC_FULL_VER != 13102140
|
||||
: handle<>(convert_to_python(source, converter))
|
||||
: handle<>(convert_to_python(source, converters))
|
||||
# else
|
||||
: m_ptr(convert_to_python(source, converter))
|
||||
: m_ptr(convert_to_python(source, converters))
|
||||
# endif
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user