Skip to content

Commit f9c8bf1

Browse files
committed
Restore CWPro7.2 to health. Also improve source organization slightly
[SVN r16416]
1 parent a7e19ff commit f9c8bf1

4 files changed

Lines changed: 27 additions & 23 deletions

File tree

include/boost/python/signature.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ get_signature(RT(*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)))
9191
# undef N
9292

9393
# define BOOST_PP_ITERATION_PARAMS_2 \
94-
(3, (0, BOOST_PYTHON_CV_COUNT - 1, <boost/python/signature.hpp>))
94+
(3, (0, 3, <boost/python/signature.hpp>))
9595
# include BOOST_PP_ITERATE()
9696

9797
#else

src/converter/arg_to_python_base.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,6 @@
1212

1313
namespace boost { namespace python { namespace converter {
1414

15-
PyObject* registration::to_python(void const volatile* source) const
16-
{
17-
if (this->m_to_python == 0)
18-
{
19-
handle<> msg(
20-
::PyString_FromFormat(
21-
"No to_python (by-value) converter found for C++ type: %s"
22-
, this->target_type.name()));
23-
24-
PyErr_SetObject(PyExc_TypeError, msg.get());
25-
26-
throw_error_already_set();
27-
}
28-
29-
return source == 0
30-
? incref(Py_None)
31-
: this->m_to_python(const_cast<void*>(source));
32-
}
33-
3415
namespace detail
3516
{
3617
arg_to_python_base::arg_to_python_base(

src/converter/registry.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
namespace boost { namespace python { namespace converter {
2020

21-
PyTypeObject* registration::get_class_object() const
21+
BOOST_PYTHON_DECL PyTypeObject* registration::get_class_object() const
2222
{
2323
if (this->m_class_object == 0)
2424
{
@@ -33,6 +33,24 @@ PyTypeObject* registration::get_class_object() const
3333
return this->m_class_object;
3434
}
3535

36+
BOOST_PYTHON_DECL PyObject* registration::to_python(void const volatile* source) const
37+
{
38+
if (this->m_to_python == 0)
39+
{
40+
handle<> msg(
41+
::PyString_FromFormat(
42+
"No to_python (by-value) converter found for C++ type: %s"
43+
, this->target_type.name()));
44+
45+
PyErr_SetObject(PyExc_TypeError, msg.get());
46+
47+
throw_error_already_set();
48+
}
49+
50+
return source == 0
51+
? incref(Py_None)
52+
: this->m_to_python(const_cast<void*>(source));
53+
}
3654

3755
namespace // <unnamed>
3856
{

test/data_members.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ BOOST_PYTHON_MODULE(data_members_ext)
4848
.def_readonly("x", &X::x)
4949
.add_property("fair_value", get_fair_value)
5050
;
51-
51+
5252
class_<Y>("Y", init<int>())
5353
.def("value", &Y::value)
5454
.def("set", &Y::set)
@@ -57,7 +57,12 @@ BOOST_PYTHON_MODULE(data_members_ext)
5757

5858
class_<Var>("Var", init<std::string>())
5959
.def_readonly("name", &Var::name)
60-
.def_readonly("name2", &Var::name2)
60+
.def_readonly("name2",
61+
#if __MWERKS__ <= 0x2407 // Old MWerks mis-deduces the type here as `char* Var::*'
62+
(char const* Var::*)
63+
#endif
64+
&Var::name2
65+
)
6166
.def_readwrite("value", &Var::value)
6267
.def_readonly("y", &Var::y)
6368

0 commit comments

Comments
 (0)