[C++-sig] Pyste: patch to fix overloaded method with policy generation bug
Baptiste Lepilleur
gaiacrtn at free.fr
Mon Jul 26 09:15:28 CEST 2004
Pyste generates wrong code in the case of methods with overload and a
specific return value policy. The code compile but when called from python
lead to a 'can not resolve ++ call' failure (it only works if all the
arguments are specified).
For example:
class NonVirtualReturnValuePolicy
{
public:
ValueHolder *set( const std::string &name_, int size_ = 10, int width_ =
12 )
};
The following code is generated:
.def("set",
&NonVirtualReturnValuePolicy::set,
return_internal_reference< 1 >(),
py::NonVirtualReturnValuePolicy_set_overloads_1_3())
instead of:
.def("set",
&NonVirtualReturnValuePolicy::set,
py::NonVirtualReturnValuePolicy_set_overloads_1_3()[
return_internal_reference< 1 >() ] )
=> the policy should be specified in square bracket.
The attached patch fix this.
Baptiste Lepilleur
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyste-overload-policy.patch
Type: application/octet-stream
Size: 1368 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040726/bd9abca0/attachment.obj>
More information about the Cplusplus-sig
mailing list