[C++-sig] preventing boost::python::throw_error_already_set

Leonard Ritter paniq at paniq.org
Mon Dec 15 16:39:12 CET 2008


On Sun, Dec 14, 2008 at 11:22 PM, Leonard Ritter <paniq at paniq.org> wrote:

> That's hard to tell without more context: Who is doing the iteration, for
>> example ?
>
>
I'm sorry. I was a bit stressed out yesterday. I recognize that you only
want to help, and I should be more patient.

Here is the top part of a stack trace, as it usually occurs:

#0  0xb65593dc in __cxa_allocate_exception () from /usr/lib/libstdc++.so.6
#1  0xb6a85a9e in boost::python::throw_error_already_set ()
   from /usr/lib/libboost_python-gcc42-1_34_1-py25.so.1.34.1
#2  0xb6a88ab1 in boost::python::objects::stop_iteration_error ()
   from /usr/lib/libboost_python-gcc42-1_34_1-py25.so.1.34.1
#3  0xb6ca38c3 in
boost::python::objects::iterator_range<boost::python::return_internal_reference<1u,
boost::python::default_call_policies>,
__gnu_cxx::__normal_iterator<halebopp::wave_range*,
std::vector<halebopp::wave_range, std::allocator<halebopp::wave_range> > >
>::next::operator() (this=0x9931cec,
    self=@0x91fcfcc) at /usr/include/boost/python/object/iterator.hpp:64

This problem occurred first when iterating an array that was exported
through the indexing suite. I do not have anything else that uses
StopIteration, so I can't say if it's really a problem of the indexing
suite. My guess is: no. When I rewrote the offending code to be a simple
get-by-index operation, the next (above) part where an iteration would be
caused inside C++ code created a problem. So somehow I end up with an
unhandled python exception in boost that does not get forwarded - my guess.

Could this in some way relate to assertions (put by assert()) put in the C++
code? Something like: boost catches these assertions, converts them into
exceptions, then iterates a bit, hits a StopIteration and has the previously
unhandled exception still active? I am just wildly guessing here.

Please help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20081215/53e54fa7/attachment.htm>


More information about the Cplusplus-sig mailing list