[C++-sig] Boost.Python Quickstart test failure/segfault on Boost 1.35.0 Python 2.5 on 64-bit Linux (RedHat)

Eric Newhuis enewhuis at gmail.com
Wed May 21 03:03:57 CEST 2008


On my platform: Linux 2.6.9-67.0.1.ELsmp #1 SMP Fri Nov 30 11:57:43 EST 
2007 x86_64 GNU/Linux

I verified that the boost python tests fail only when I provide a 
user-config.jam file that points to a 64-bit Python 2.5.

If I don’t provide such a file then the default choices made by BJAM 
result in a passing test.

It doesn’t matter if threading=single or multi or variant=debug or 
release. I get similar results.

Does anyone have a clue what is going on and how to fix this?

After the stack trace see the bottom of this email for additional info 
about warnings I see during compilation. I don't know if they are related.

The failing line in question appears to be decrementing a reference count.

#0 0x0000000000000000 in ?? ()
#1 0x0000002a998830fc in ~object_base (this=0x7fbfffb0f0) at 
../../../../boost/python/object_core.hpp:436
#2 0x0000002a998830c5 in ~object (this=0x7fbfffb0f0) at 
../../../../boost/python/slice_nil.hpp:16
#3 0x0000002a99a254d1 in ~dict_base (this=0x7fbfffb0f0) at 
../../../../boost/python/dict.hpp:89
#4 0x0000002a99a254b9 in ~dict (this=0x7fbfffb0f0) at 
../../../../libs/python/src/object/enum.cpp:139
#5 0x0000002a99a28a6b in boost::python::objects::(anonymous 
namespace)::new_class (name=0x2a9988812a "hello", num_types=1, 
types=0x7fbfffb1e8, doc=0x0)
at ../../../../libs/python/src/object/class.cpp:539
#6 0x0000002a99a27969 in class_base (this=0x7fbfffb250, 
name=0x2a9988812a "hello", num_types=1, types=0x7fbfffb1e8, doc=0x0)
at ../../../../libs/python/src/object/class.cpp:546
#7 0x0000002a9988328c in class_<boost::python::init<std::string, 
mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, 
mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, 
mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> > 
(this=0x7fbfffb250, name=0x2a9988812a "hello", i=@0x7fbfffb230)
at ../../../../boost/python/class.hpp:207
#8 0x0000002a99882e77 in init_module_extending () at extending.cpp:32
#9 0x0000002a99a416be in 
boost::detail::function::void_function_ref_invoker0<void (*)(), 
void>::invoke (function_obj_ptr=@0x7fbfffb358)
at ../../../../boost/function/function_template.hpp:193
#10 0x0000002a99a40fa8 in boost::function0<void, 
std::allocator<boost::function_base> >::operator() (this=0x7fbfffb350)
at ../../../../boost/function/function_template.hpp:824
#11 0x0000002a99a409fb in boost::python::handle_exception_impl (f=
{<boost::function_base> = {vtable = 0x2a99b752e0, functor = {obj_ptr = 
0x7fbfffb378, const_obj_ptr = 0x7fbfffb378, func_ptr = 0x7fbfffb378, 
bound_memfunc_ptr = {memfunc_ptr = {__pfn = 0x7fbfffb378, __delta = 
548682052496}, obj_ptr = 0x2a99a4144f}, data = 120 'x'}}, static args = 
<optimized out>, static arity = <optimized out>})
at ../../../../libs/python/src/errors.cpp:25
#12 0x0000002a99a414d9 in boost::python::handle_exception<void (*)()> 
(f=0x2a99882e4c <init_module_extending()>) at 
../../../../boost/python/errors.hpp:29
#13 0x0000002a99a41347 in boost::python::detail::init_module 
(name=0x2a99888120 "extending", init_function=0x2a99882e4c 
<init_module_extending()>)
at ../../../../libs/python/src/module.cpp:39
#14 0x0000002a99882e49 in initextending () at extending.cpp:29
#15 0x0000002a95647e43 in _PyImport_LoadDynamicModule (name=0x7fbfffc630 
"extending",
pathname=0x7fbfffb530 
"/home/users/ericn/boost_1_35_0/libs/python/example/quickstart/bin/gcc-3.4.6/debug/threading-multi/extending.so", 
fp=0x632280)
at ./Python/importdl.c:53
#16 0x0000002a956450a0 in load_module (name=0x7fbfffc630 "extending", 
fp=0x632280,
buf=0x7fbfffb530 
"/home/users/ericn/boost_1_35_0/libs/python/example/quickstart/bin/gcc-3.4.6/debug/threading-multi/extending.so", 
type=3, loader=0x0)
at Python/import.c:1758
#17 0x0000002a956466e0 in import_submodule (mod=0x2a957be230, 
subname=0x7fbfffc630 "extending", fullname=0x7fbfffc630 "extending") at 
Python/import.c:2400
#18 0x0000002a95645ff5 in load_next (mod=0x2a957be230, 
altmod=0x2a957be230, p_name=0x7fbfffd668, buf=0x7fbfffc630 "extending", 
p_buflen=0x7fbfffc628)
at Python/import.c:2220
#19 0x0000002a956457b7 in import_module_level (name=0x0, 
globals=0x60de80, locals=0x60de80, fromlist=0x2a991b8710, level=-1) at 
Python/import.c:2001
#20 0x0000002a95645b1b in PyImport_ImportModuleLevel (name=0x2a991be32c 
"extending", globals=0x60de80, locals=0x60de80, fromlist=0x2a991b8710, 
level=-1)
at Python/import.c:2072
#21 0x0000002a9561dec4 in builtin___import__ (self=0x0, 
args=0x2a95b20d08, kwds=0x0) at Python/bltinmodule.c:47
#22 0x0000002a955ce52a in PyCFunction_Call (func=0x2a95abb5f0, 
arg=0x2a95b20d08, kw=0x0) at Objects/methodobject.c:77
#23 0x0000002a95599373 in PyObject_Call (func=0x2a95abb5f0, 
arg=0x2a95b20d08, kw=0x0) at Objects/abstract.c:1861
#24 0x0000002a9562bb14 in PyEval_CallObjectWithKeywords 
(func=0x2a95abb5f0, arg=0x2a95b20d08, kw=0x0) at Python/ceval.c:3442
#25 0x0000002a95628562 in PyEval_EvalFrameEx (f=0x6158d0, throwflag=0) 
at Python/ceval.c:2067
#26 0x0000002a9562a7b6 in PyEval_EvalCodeEx (co=0x2a95b26af8, 
globals=0x60de80, locals=0x60de80, args=0x0, argcount=0, kws=0x0, 
kwcount=0, defs=0x0, defcount=0,
closure=0x0) at Python/ceval.c:2836
#27 0x0000002a95623a42 in PyEval_EvalCode (co=0x2a95b26af8, 
globals=0x60de80, locals=0x60de80) at Python/ceval.c:494
#28 0x0000002a9562dc05 in exec_statement (f=0x630de0, prog=0x2a95b26af8, 
globals=0x60de80, locals=0x60de80) at Python/ceval.c:4177
#29 0x0000002a95626e60 in PyEval_EvalFrameEx (f=0x630de0, throwflag=0) 
at Python/ceval.c:1666
#30 0x0000002a9562a7b6 in PyEval_EvalCodeEx (co=0x2a989b5828, 
globals=0x518bb0, locals=0x0, args=0x617f80, argcount=4, kws=0x617fa0, 
kwcount=0, defs=0x0, defcount=0,
closure=0x0) at Python/ceval.c:2836
#31 0x0000002a9562c5b2 in fast_function (func=0x2a991bc230, 
pp_stack=0x7fbfffe080, n=4, na=4, nk=0) at Python/ceval.c:3669
#32 0x0000002a9562c311 in call_function (pp_stack=0x7fbfffe080, oparg=3) 
at Python/ceval.c:3594
#33 0x0000002a95628e6e in PyEval_EvalFrameEx (f=0x617dd0, throwflag=0) 
at Python/ceval.c:2272
#34 0x0000002a9562a7b6 in PyEval_EvalCodeEx (co=0x2a989b5990, 
globals=0x518bb0, locals=0x0, args=0x5209c0, argcount=2, kws=0x5209d0, 
kwcount=0, defs=0x2a991b7978,
defcount=3, closure=0x0) at Python/ceval.c:2836
#35 0x0000002a9562c5b2 in fast_function (func=0x2a991bc398, 
pp_stack=0x7fbfffe450, n=2, na=2, nk=0) at Python/ceval.c:3669
#36 0x0000002a9562c311 in call_function (pp_stack=0x7fbfffe450, oparg=1) 
at Python/ceval.c:3594
#37 0x0000002a95628e6e in PyEval_EvalFrameEx (f=0x5207e0, throwflag=0) 
at Python/ceval.c:2272
#38 0x0000002a9562a7b6 in PyEval_EvalCodeEx (co=0x2a989bb378, 
globals=0x518bb0, locals=0x0, args=0x520780, argcount=1, kws=0x520788, 
kwcount=1, defs=0x2a98d5fbe8,
defcount=9, closure=0x0) at Python/ceval.c:2836
#39 0x0000002a9562c5b2 in fast_function (func=0x2a991b95f0, 
pp_stack=0x7fbfffe820, n=3, na=1, nk=1) at Python/ceval.c:3669
#40 0x0000002a9562c311 in call_function (pp_stack=0x7fbfffe820, 
oparg=257) at Python/ceval.c:3594
#41 0x0000002a95628e6e in PyEval_EvalFrameEx (f=0x5205e0, throwflag=0) 
at Python/ceval.c:2272
#42 0x0000002a9562a7b6 in PyEval_EvalCodeEx (co=0x2a95b18300, 
globals=0x524510, locals=0x0, args=0x568f08, argcount=0, kws=0x568f08, 
kwcount=0, defs=0x2a95b244a8,
defcount=1, closure=0x0) at Python/ceval.c:2836
#43 0x0000002a9562c5b2 in fast_function (func=0x2a95b11938, 
pp_stack=0x7fbfffebf0, n=0, na=0, nk=0) at Python/ceval.c:3669
#44 0x0000002a9562c311 in call_function (pp_stack=0x7fbfffebf0, oparg=0) 
at Python/ceval.c:3594
#45 0x0000002a95628e6e in PyEval_EvalFrameEx (f=0x568d80, throwflag=0) 
at Python/ceval.c:2272
#46 0x0000002a9562a7b6 in PyEval_EvalCodeEx (co=0x2a95b11648, 
globals=0x524510, locals=0x524510, args=0x0, argcount=0, kws=0x0, 
kwcount=0, defs=0x0, defcount=0,
closure=0x0) at Python/ceval.c:2836
#47 0x0000002a95623a42 in PyEval_EvalCode (co=0x2a95b11648, 
globals=0x524510, locals=0x524510) at Python/ceval.c:494
#48 0x0000002a95650e3c in run_mod (mod=0x51e130, filename=0x7fbffff4be 
"test_extending.py", globals=0x524510, locals=0x524510, 
flags=0x7fbffff050, arena=0x543950)
at Python/pythonrun.c:1273
#49 0x0000002a95650dc6 in PyRun_FileExFlags (fp=0x501010, 
filename=0x7fbffff4be "test_extending.py", start=257, globals=0x524510, 
locals=0x524510, closeit=1,
flags=0x7fbffff050) at Python/pythonrun.c:1259
#50 0x0000002a9564fdcf in PyRun_SimpleFileExFlags (fp=0x501010, 
filename=0x7fbffff4be "test_extending.py", closeit=1, 
flags=0x7fbffff050) at Python/pythonrun.c:879
#51 0x0000002a9564f711 in PyRun_AnyFileExFlags (fp=0x501010, 
filename=0x7fbffff4be "test_extending.py", closeit=1, 
flags=0x7fbffff050) at Python/pythonrun.c:698
#52 0x0000002a9565c5c2 in Py_Main (argc=2, argv=0x7fbffff1c8) at 
Modules/main.c:523
#53 0x0000000000400793 in main ()


I get the following warnings. Are they benign?

1.

../../../../libs/python/src/str.cpp: In function `boost::python::ssize_t
boost::python::detail::<unnamed>::str_size_as_py_ssize_t(size_t)' :
../../../../libs/python/src/str.cpp:29: warning: comparison between
signed and unsigned integer expressions

2.

../../../../libs/python/src/object/class.cpp: In function
`boost::python::api::object
boost::python::objects::<unnamed>::new_class(const char*, size_t, const
boost::python::type_info*, const char*)':
../../../../libs/python/src/object/class.cpp:510: warning: comparison
between signed and unsigned integer expressions

3.

../../../../libs/python/src/object/function.cpp: In member function
`PyObject* boost::python::objects::function::call(PyObject*, PyObject*)
const':
../../../../libs/python/src/object/function.cpp:169: warning: comparison
between signed and unsigned integer expressions




More information about the Cplusplus-sig mailing list