Boost logo

Boost :

From: Andreas Dietrich (quasi_at_[hidden])
Date: 2001-08-17 08:48:15


On Fri, Aug 17, 2001 at 09:38:06AM -0400, David Abrahams wrote:
>
> From: "Andreas Dietrich" <quasi_at_[hidden]>

> > The following code results in a segfault when calling test from python:
>
> The most obvious explanation I can imagine is that someone is trying to
> increment a reference-count on the null pointer you're returning. If you can
> post a GDB stack backtrace, I might be able to give you a better assessment,
> though.

Hmmm.

I don't think it has anything to do with the nullpointer. My original
function lead to a crash even when returning a valid PyObject.

Here is a stack trace (everything compiled for python 2.1 with -g -ftemplate-depth-21)

#0 to_python (p=0x0) at /home/dada/boost_1_23_0/boost/python/conversions.hpp:327
#1 0x4021ff16 in _object * boost::python::caller<_object *>::call<int, int> (f=0x40217cd0 <{anonymous}::test(int, int)>,
    args=0x810351c) at /home/dada/boost_1_23_0/boost/python/caller.hpp:448
#2 0x4021fe39 in boost::python::detail::wrapped_function_pointer<_object *, _object *(*)>::do_call (this=0x8132080,
    args=0x810351c, keywords=0x0) at /home/dada/boost_1_23_0/boost/python/detail/functions.hpp:69
#3 0x40218df6 in boost::python::detail::function::call (this=0x8132080, args=0x810351c, keywords=0x0) at functions.cpp:69
#4 0x40222895 in boost::python::detail::callable<boost::python::detail::type_object<boost::python::detail::function> >::instance_call (this=0x4022ea40, obj=0x8132080, args=0x810351c, kw=0x0)
    at /home/dada//boost_1_23_0/boost/python/detail/types.hpp:235
#5 0x40223bb7 in _object * boost::python::{anonymous}::call<_object *, _object *>
      (obj=0x8132080, f=invalid pointer to member function) at types.cpp:95
#6 0x4021cfca in do_instance_call (obj=0x8132080, args=0x810351c, keywords=0x0) at types.cpp:179

Thanks for your effort.

Andreas

-- 
"We've heard that a million monkeys at a million keyboards could produce the
complete works of Shakespeare. Now, thanks to the Internet, we know this is not
true."  -- Robert Wilensky

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk