[C++-sig] New implementation for opaque_pointer_converter

Gottfried Ganßauge Gottfried.Ganssauge at haufe.de
Sun Mar 9 22:40:09 CET 2003


> Hi Gottfried,
hi,
>
> I was trying to apply your patch (which basically looks very good),
> and it seems there are some problems with NULL opaque pointer
> conversions.  The enclosed test files demonstrate.
> If you can get this cleared up in the next couple of days, I'll merge
> it into the 1.30.0 branch.
The problem - as I see it - is the following
There exists an arg_from_python-converter which - in it's
convertible()-method - basically says: conversion of NULL-pointers is not
valid.
I see tow ways around that.
The first one is fairly simple: just return Py_None from
opaque_pointer_converter::convert() if a NULL-pointer is to be converted.
It's drawback was already made obvious in your test case: the assertion
(type(getnull()) == type(get()) won't hold.
The second one is much more difficult (at least for me):
We need a new type class which says: I'm a pointer but I have value
semantics in the sense of  arg_rvalue_from_python<>. This can be used in the
select_arg_from_python<> template to select the proper converter for opaque
pointers.
What do you think?

Cheers,

Gottfried






More information about the Cplusplus-sig mailing list