mirror of
https://github.com/boostorg/python.git
synced 2026-01-23 17:52:17 +00:00
New function invocation mechanism. This is the major groundwork for handling virtual functions with default implementations properly
[SVN r16388]
This commit is contained in:
@@ -12,26 +12,23 @@
|
||||
|
||||
namespace boost { namespace python { namespace converter {
|
||||
|
||||
namespace
|
||||
PyObject* registration::to_python(void const volatile* source) const
|
||||
{
|
||||
inline PyObject* convert_to_python(void const volatile* source, registration const& converters)
|
||||
if (this->m_to_python == 0)
|
||||
{
|
||||
if (converters.to_python == 0)
|
||||
{
|
||||
handle<> msg(
|
||||
::PyString_FromFormat(
|
||||
"No to_python (by-value) converter found for C++ type: %s"
|
||||
, converters.target_type.name()));
|
||||
handle<> msg(
|
||||
::PyString_FromFormat(
|
||||
"No to_python (by-value) converter found for C++ type: %s"
|
||||
, this->target_type.name()));
|
||||
|
||||
PyErr_SetObject(PyExc_TypeError, msg.get());
|
||||
PyErr_SetObject(PyExc_TypeError, msg.get());
|
||||
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
return source == 0
|
||||
? incref(Py_None)
|
||||
: converters.to_python(const_cast<void*>(source));
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
return source == 0
|
||||
? incref(Py_None)
|
||||
: this->m_to_python(const_cast<void*>(source));
|
||||
}
|
||||
|
||||
namespace detail
|
||||
@@ -39,10 +36,11 @@ namespace detail
|
||||
arg_to_python_base::arg_to_python_base(
|
||||
void const volatile* source, registration const& converters)
|
||||
# if !defined(BOOST_MSVC) || BOOST_MSVC <= 1300 || _MSC_FULL_VER > 13102179
|
||||
: handle<>(converter::convert_to_python(source, converters))
|
||||
: handle<>
|
||||
# else
|
||||
: m_ptr(converter::convert_to_python(source, converters))
|
||||
# endif
|
||||
: m_ptr
|
||||
# endif
|
||||
(converters.to_python(source))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace registry
|
||||
# ifdef BOOST_PYTHON_TRACE_REGISTRY
|
||||
std::cout << "inserting to_python " << source_t << "\n";
|
||||
# endif
|
||||
to_python_function_t& slot = get(source_t)->to_python;
|
||||
to_python_function_t& slot = get(source_t)->m_to_python;
|
||||
|
||||
assert(slot == 0); // we have a problem otherwise
|
||||
if (slot != 0)
|
||||
|
||||
Reference in New Issue
Block a user