2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-27 07:02:15 +00:00

Restore CWPro7.2 to health. Also improve source organization slightly

[SVN r16416]
This commit is contained in:
Dave Abrahams
2002-11-26 02:47:17 +00:00
parent a7e19ffb0b
commit f9c8bf15bb
4 changed files with 27 additions and 23 deletions

View File

@@ -91,7 +91,7 @@ get_signature(RT(*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)))
# undef N
# define BOOST_PP_ITERATION_PARAMS_2 \
(3, (0, BOOST_PYTHON_CV_COUNT - 1, <boost/python/signature.hpp>))
(3, (0, 3, <boost/python/signature.hpp>))
# include BOOST_PP_ITERATE()
#else

View File

@@ -12,25 +12,6 @@
namespace boost { namespace python { namespace converter {
PyObject* registration::to_python(void const volatile* source) const
{
if (this->m_to_python == 0)
{
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());
throw_error_already_set();
}
return source == 0
? incref(Py_None)
: this->m_to_python(const_cast<void*>(source));
}
namespace detail
{
arg_to_python_base::arg_to_python_base(

View File

@@ -18,7 +18,7 @@
namespace boost { namespace python { namespace converter {
PyTypeObject* registration::get_class_object() const
BOOST_PYTHON_DECL PyTypeObject* registration::get_class_object() const
{
if (this->m_class_object == 0)
{
@@ -33,6 +33,24 @@ PyTypeObject* registration::get_class_object() const
return this->m_class_object;
}
BOOST_PYTHON_DECL PyObject* registration::to_python(void const volatile* source) const
{
if (this->m_to_python == 0)
{
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());
throw_error_already_set();
}
return source == 0
? incref(Py_None)
: this->m_to_python(const_cast<void*>(source));
}
namespace // <unnamed>
{

View File

@@ -48,7 +48,7 @@ BOOST_PYTHON_MODULE(data_members_ext)
.def_readonly("x", &X::x)
.add_property("fair_value", get_fair_value)
;
class_<Y>("Y", init<int>())
.def("value", &Y::value)
.def("set", &Y::set)
@@ -57,7 +57,12 @@ BOOST_PYTHON_MODULE(data_members_ext)
class_<Var>("Var", init<std::string>())
.def_readonly("name", &Var::name)
.def_readonly("name2", &Var::name2)
.def_readonly("name2",
#if __MWERKS__ <= 0x2407 // Old MWerks mis-deduces the type here as `char* Var::*'
(char const* Var::*)
#endif
&Var::name2
)
.def_readwrite("value", &Var::value)
.def_readonly("y", &Var::y)