[C++-sig] [ boost.python] problems with python 2.7 on AIX, boost 1.45 and vacpp v11.1

Avi Bahra avibahra at googlemail.com
Tue Jan 3 11:54:46 CET 2012


I have a crash when importing my boost python
extension. With the following configuration.
   - python 2.7
   - boost 1.45
   - vacpp 11.1
   - AIX 5.3
The problem can be reproduced with boost python examples as well.

Currently I have a working solution using python 2.54.

This is what the core dump shows:

boost::python::incref<_object>,
boost::python::api::object::object,
boost::python::api::slice_nil::slice_nil,
__init__0,
...2femos_5fesuite_2femos_5fdata_2fsms_2fecflow_5f2_5f0_5f22_2fPyext_2fsrc_2fBoostPythonUtil_2ecpp,
FP=fffffffffff3d00
     .initialize_one_library__Fi,
     .initialize_libs__FPii,
     .load_libs__FPcPFv_iT1,
     .loadAndInit,
     .dlopen,
     ._PyImport_GetDynLoadFunc,
     ._PyImport_LoadDynamicModule,
     .initimp,
     .initimp,
     .initimp,
     .initimp,
     .PyImport_ImportModuleLevel,
     .fgets,

Here is the code associated with the stack dump above;

----------------------------------------------------------------
template <class T>
 inline T* incref(T* p)
 {
     Py_INCREF(python::upcast<PyObject>(p));
     return p;
 }
------------------------------------------------------------
inline object::object()
     : object_base(python::incref(Py_None))
 {}

------------------------------------------------------------
#ifndef SLICE_NIL_DWA2002620_HPP
 # define SLICE_NIL_DWA2002620_HPP

 # include <boost/python/detail/prefix.hpp>
 # include <boost/python/object_core.hpp>

 namespace boost { namespace python { namespace api {

 class slice_nil : public object
 {
  public:
     slice_nil() : object() {}
 };

 # ifndef _ // Watch out for GNU gettext users, who #define _(x)
 static const slice_nil _ = slice_nil();
 # endif

===========================================

Total view shows that p(i.e Py_None) is NULL/0

It appears that when the static slice_nil is created at
module import time. We end up with Py_None being
 NULL/0.
Could this be a problem with the way the python 2.7 was
installed/set up.

Any help would be greatly appreciated.


   Best regards,
Ta,
    Avi


More information about the Cplusplus-sig mailing list