[C++-sig] BPL and Py_Clear()
David Abrahams
dave at boost-consulting.com
Wed Jun 15 23:41:23 CEST 2005
"Niall Douglas" <s_sourceforge at nedprod.com> writes:
> On 15 Jun 2005 at 11:47, David Abrahams wrote:
>
>> >> >> I'm confused now. If you pass an int* without wrapping it in
>> >> >> ptr() that's exactly what happens, right?
>> >> >
>> >> > I don't know about int, but unsigned int * yields a runtime error
>> >> > of no to-python converter for unsigned int.
>> >>
>> >> Oh, drat. But then, why not just dereference the pointer and pass
>> >> that?
>> >
>> > Because I want to pass the pointer, not what it points to.
>>
>> I don't get it. If you expect the Python code to just see a Python
>> int, what's the advantage in passing a pointer? You are aware that
>> Python ints are immutable, I presume!
>
> Because if my C++ is going through a BPL wrapped virtual function and
> is passing it an array of unsigned int, if python doesn't overload it
> then it goes C++=>Python=>C++ and no extra action is required.
Not if you use the new-style polymorphism support.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list