[C++-sig] Problem with extracting a C++ object from python

David Abrahams dave at boost-consulting.com
Sat Oct 29 14:35:54 CEST 2005


"Matt" <mjkeyes at sbcglobal.net> writes:

Matt, see http://www.boost.org/libs/python/doc/v2/faq.html#dangling

> I think I found a workaround.  If I receive the call from the base class 
> into a str object and extract a const char * from it, then I get no dangling 
> references.  

Sounds to me like you've just found a way to silence the helpful
protective error message without curing the actual problem, and even
if it appears to work now, your code will probably crash one day.

> I'm guessing that since this object is never passed to Python 
> (I assume) that the dangling pointer comes from that.  Not sure...
>
> "Matt" <mjkeyes at sbcglobal.net> wrote in message 
> news:dju6nq$ah8$1 at sea.gmane.org...
>> Okay, now I have another question.  Let's consider the same scenario with 
>> a slight modification:
>>

<snip entire foregoing post>

Please don't overquote; thanks.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list