[C++-sig] problem with python::dict[]

harold fellermann harold at imb-jena.de
Wed Feb 26 18:54:29 CET 2003


Hello,

I got your address from 
http://mail.python.org/pipermail/c++-sig/2002-June/001311.html -- so I 
don't know whether you are the right person to ask.
I think I have found an error in the boost.python's dict-interface.

My following code-snippet runs into segmantation fault:

#include <stdlib.h>
#include <boost/python/dict.hpp>

using namespace boost::python;

int main()
{
   dict x[750];

   return 0;
}


The problem seems to concern the garbage collector from the 
Python/C-API, as
my debugger tells me, the program crashes in _PyObject_GC_New():


(gdb) run
Starting program: /home/tsb/harold/c_network/pytest
[New Thread 1024 (LWP 25905)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 25905)]
0x0809a909 in PyErr_Occurred ()
(gdb) bt
#0  0x0809a909 in PyErr_Occurred ()
#1  0x080addca in _PyObject_GC_New ()
#2  0x08064edc in PyDict_New ()
#3  0x4003b1f4 in boost::python::detail::dict_base::dict_base() ()
    from /usr/local/lib/libboost_python.so.1.29.0
#4  0x080c6c6c in main () at pytest.c:9
#5  0x401744a2 in __libc_start_main () from /lib/libc.so.6


I tried this with a couple of python-objects and all containers (dict, 
list, ...)
crashed in exactly the same way. Interestingly the program behaves 
normal when
I reduce the number of objects within my array to approx. 700.

My configuration looks as follows:
- python 2.2.1 (#1, Sep 10 2002, 17:49:17)
- gcc 3.2
- boost version 1.29.0

Do you have any idea what is going on here? Is this a known bug, maybe 
even a nowadays fixed one? Or is it only a question of configuration? 
Any help will be appreciated!


thanx,

- harold fellermann -


--
He who wonders discovers that this in itself is wonder.
-- M.C. Escher





More information about the Cplusplus-sig mailing list