[C++-sig] Re: Making copy of function derived from C++ pure virtual function

David Abrahams dave at boost-consulting.com
Mon Dec 13 20:06:26 CET 2004


Paul F. Kunz wrote:
>>>>>> On Sun, 12 Dec 2004 22:26:21 -0500, David Abrahams <dave at boost-consulting.com> said:
> 
>> This means some Python exception is being thrown.  You might set a
>> breakpoint on boost::python::detail::throw_error_already_set (I
>> think I have the namespace right) and look just up the stack to see
>> what the actual error being reported is.
> 
>    Doing that, I find exception being thrown from here...
> 
> template <class T>
> inline T* expect_non_null(T* x)
> {
>     if (x == 0)
>         throw_error_already_set();
>     return x;
> }
> 
> x is 0.   This is result of calling...
> 
> 	FunctionWrap * t = const_cast < FunctionWrap * > ( this );
> 	object self = get_owner ( t );
> 
> 	// Find its most-derived Python class
> 	object my_class = self.attr("__class__");
> 
> 	// call the copy ctor through Python.
> 	py_result = my_class(self);

Ahem.  Which line above and precisely which part of the expression on
that line is being evaluated?

> This probably doesn't help, but thought I mentioned it in case it
> rings a bell.

No bell-ringing.
The exception should be caught by Boost.Python and returned to Python as
a Python exception.  Python isn't issuing any error message?
-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Cplusplus-sig mailing list