[C++-sig] Sporadic access faults in boost::python::converter::registry::query()

David Helgason david at uti.is
Wed May 14 13:30:05 CEST 2003


I hope I can make this understandable.

I am using CodeWarrior 8.3 on OS X 10.2.6, with a Boost::Python CVS  
checkout from february.

I have exported a class (Collider) to python. I use a pattern  
previously suggested on this list I believe for registering the  
converter (and a hack to solve a CodeWarrior bug with an identity  
function, also suggested here) in a thread called "Exporting references  
into python", 2nd and 3rd of March this year.

Now, when I try to convert types with no registered converter, I  
rightly get an error. But when I try to convert my registered class  
Collider, it sometimes works and sometimes gives an access fault. The  
last part of the stack trace is attached below.

Now, I have tried to debug this by looking at the set<entry> lookup  
which goes on here,

       registry_t::iterator p = entries().find(entry(type));

but the CW debugger consistently crashes when I try. Intercepting the  
call on the way in (at levels 3-18 in the stacktrace), I don't see any  
difference with the data coming in: I certainly have no NULL pointer  
coming in.

I suspect foul play by the compiler, and wonder if this is a known  
problem and/or whether I should try to upgade to a newer version of  
boost::python.


I will of course submit code samples if anyone is interested, or follow  
any other instructions for that matter.


Regards,
David Helgason


***********

Date/Time:  2003-05-13 15:39:49 +0200
OS Version: 10.2.6 (Build 6L60)
Host:       bao.local.

Command:    Crimson Editor
PID:        28721

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000005

Thread 0 Crashed:
  #0   0x003d4e2c in  
_ZNSt6__treeIN5boost6python9converter12registrationENSt4lessIS3_EESaIS3_ 
EE4findIS3_EENS_18__generic_iteratorILb0EEERKT2_
  #1   0x00154fc0 in  
boost::python::converter::registry::query(boost::python::type_info)
  #2   0x0009e0f0 in  
_ZN5boost6python7objects17make_ptr_instanceI8ColliderNS1_14pointer_holde 
rIPS3_S3_EEE24get_derived_class_objectIS3_EEP11_typeobjectNS_3mpl6bool_c 
ILb1EEEPVKT1_
  #3   0x0009e07c in  
_ZN5boost6python7objects17make_ptr_instanceI8ColliderNS1_14pointer_holde 
rIPS3_S3_EEE21get_class_object_implIS3_EEP11_typeobjectPVKT1_
  #4   0x0009e034 in  
_ZN5boost6python7objects17make_ptr_instanceI8ColliderNS1_14pointer_holde 
rIPS3_S3_EEE16get_class_objectIS5_EEP11_typeobjectRKT1_
  #5   0x0009def4 in  
_ZN5boost6python7objects18make_instance_implI8ColliderNS1_14pointer_hold 
erIPS3_S3_EENS1_17make_ptr_instanceIS3_S6_EEE7executeIS5_EEP7_objectRT2_
  #6   0x0009debc in object*  
boost::python::detail::make_reference_holder::execute<Collider>(Collider 
*)
  #7   0x0031686c in  
_ZN5boost6python6detail14unwind_type_cvINS1_21make_reference_holderE8Col 
liderEENT_11result_typeEPT0_NS1_6cv_tagILb0ELb0EEEPT_
  #8   0x00316844 in  
_ZN5boost6python6detail15unwind_ptr_typeINS1_21make_reference_holderE8Co 
lliderEENT_11result_typeEPT0_PT_
  #9   0x0009de94 in  
_ZN5boost6python6detail13unwind_helperILb1EE7executeINS1_21make_referenc 
e_holderEP8ColliderEENT0_11result_typeET1_PT0_
  #10  0x00316808 in  
_ZN5boost6python6detail11unwind_typeINS1_21make_reference_holderEP8Colli 
derEENT_11result_typeERKT0_PT_
  #11  0x003167d0 in boost::python::to_python_indirect<Collider*&,  
boost::python::detail::make_reference_holder>::operator()(Collider*&)  
const
  #12  0x0031677c in  
boost::python::converter::detail::reference_arg_to_python<Collider*>::ge 
t_object(Collider*&)
  #13  0x0031673c in  
boost::python::converter::detail::reference_arg_to_python<Collider*>::re 
ference_arg_to_python[in-charge](Collider*&)
  #14  0x00316704 in  
boost::python::converter::arg_to_python<boost::reference_wrapper<Collide 
r*> >::arg_to_python[in-charge](boost::reference_wrapper<Collider*>  
const&)
  #15  0x003165d4 in  
_ZN5boost6python4callINS0_3api6objectENS_17reference_wrapperIP8ColliderE 
EEENNS0_6detail10returnableIT_EE4typeEP7_objectRKT0_PNS_4typeIT_EE
  #16  0x0009c9b8 in  
_ZNK5boost6python3api16object_operatorsINS1_6objectEEclINS_17reference_w 
rapperIP8ColliderEEEENNS0_6detail9dependentIS3_T0_EE4typeERKT0_
  #17  0x0031353c in boost::python::api::object  
NotificationDataConvertT<Collider>(NotificationData&)
  #18  0x00080e54 in ConvertNotificationDataToPython(NotificationData&)
// ... 26 layers of my own code here






More information about the Cplusplus-sig mailing list