[C++-sig] BPL and Py_Clear()
David Abrahams
dave at boost-consulting.com
Wed Jun 15 17:47:45 CEST 2005
"Niall Douglas" <s_sourceforge at nedprod.com> writes:
> On 14 Jun 2005 at 9:01, David Abrahams wrote:
>
>> >> >> > Why doesn't BPL's ptr() accept pointers to integral types?
>> >> >>
>> >> >> Think about how you would implement such a thing. What would a
>> >> >> an overriden virtual function written in Python see?
>> >> >
>> >> > A single item of whatever type eg; long * would mean the python
>> >> > code sees a python integer.
>> >>
>> >> 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!
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list