2
0
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:
Dave Abrahams
2002-11-24 02:43:24 +00:00
parent 05ce65d9d2
commit e14e4e156c
13 changed files with 563 additions and 189 deletions

View File

@@ -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))
{
}

View File

@@ -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)