Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-08-17 10:31:12


----- Original Message -----
From: "Andreas Dietrich" <quasi_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, August 17, 2001 9:48 AM
Subject: Re: [boost] BPL crash

> 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)

Well, I don't think this is too hard to figure out, even for the
uninitiated. Just look at
/home/dada/boost_1_23_0/boost/python/conversions.hpp:327, as indicated
below. My theory is borne out:

inline PyObject* to_python(PyObject* p)
{
    Py_INCREF(p); <<<<<<<<<<<<
    return p;
}

> #0 to_python (p=0x0) at
/home/dada/boost_1_23_0/boost/python/conversions.hpp:327

Also, note that the argument, p, is NULL.

The rest of the stack trace looks fine to me.

-Dave

> #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::py
thon::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
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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