diff --git a/test/m1.cpp b/test/m1.cpp index f4ad6390..809a0d63 100644 --- a/test/m1.cpp +++ b/test/m1.cpp @@ -14,8 +14,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -141,12 +141,12 @@ struct simple_ref_wrapper struct native_int_unwrapper : boost::python::converter::unwrapper { - bool convertible(PyObject* p) const + void* can_convert(PyObject* p) const { - return PyInt_Check(p); + return PyInt_Check(p) ? non_null : 0; } - int convert(PyObject* p, void*&) const + int convert(PyObject* p, void*, boost::type) const { return PyInt_AsLong(p); } @@ -155,12 +155,12 @@ struct native_int_unwrapper struct noddy_int_unwrapper : boost::python::converter::unwrapper { - bool convertible(PyObject* p) const + void* can_convert(PyObject* p) const { - return p->ob_type == &NoddyType; + return p->ob_type == &NoddyType ? non_null : 0; } - int convert(PyObject* p, void*&) const + int convert(PyObject* p, void*, boost::type) const { return static_cast(p)->x; } @@ -169,12 +169,12 @@ struct noddy_int_unwrapper struct noddy_int_ref_unwrapper : boost::python::converter::unwrapper { - bool convertible(PyObject* p) const + void* can_convert(PyObject* p) const { - return p->ob_type == &NoddyType; + return p->ob_type == &NoddyType ? non_null : 0; } - int& convert(PyObject* p, void*&) const + int& convert(PyObject* p, void*, boost::type) const { return static_cast(p)->x; } @@ -183,12 +183,12 @@ struct noddy_int_ref_unwrapper struct simple_ref_unwrapper : boost::python::converter::unwrapper { - bool convertible(PyObject* p) const + void* can_convert(PyObject* p) const { - return p->ob_type == &SimpleType; + return p->ob_type == &SimpleType ? non_null : 0; } - simple& convert(PyObject* p, void*&) const + simple& convert(PyObject* p, void*, boost::type) const { return static_cast(p)->x; } @@ -197,12 +197,12 @@ struct simple_ref_unwrapper struct simple_const_ref_unwrapper : boost::python::converter::unwrapper { - bool convertible(PyObject* p) const + void* can_convert(PyObject* p) const { - return p->ob_type == &SimpleType; + return p->ob_type == &SimpleType ? non_null : 0; } - simple const& convert(PyObject* p, void*&) const + simple const& convert(PyObject* p, void*, boost::type) const { return static_cast(p)->x; } @@ -228,12 +228,12 @@ BOOST_PYTHON_MODULE_INIT(m1) static noddy_int_unwrapper unwrap_int2; static noddy_int_ref_unwrapper unwrap_int3; static simple_ref_unwrapper unwrap_simple; + static simple_const_ref_unwrapper unwrap_simple_const_ref; #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // These compilers will need additional converters - static simple_const_ref_unwrapper unwrap_simple_const_ref; static simple_ref_wrapper wrap_simple_ref; #endif - static boost::python::object::class_unwrapper unwrap_complicated; + static boost::python::converter::class_unwrapper unwrap_complicated; PyObject* d = PyModule_GetDict(m1); if (d == NULL)