[C++-sig] Re: Making copy of function derived from C++ pure virtual function

Paul F. Kunz Paul_Kunz at slac.stanford.edu
Mon Dec 13 19:22:29 CET 2004


>>>>> On Sun, 12 Dec 2004 22:26:21 -0500, David Abrahams <dave at boost-consulting.com> said:

> This means some Python exception is being thrown.  You might set a
> breakpoint on boost::python::detail::throw_error_already_set (I
> think I have the namespace right) and look just up the stack to see
> what the actual error being reported is.

   Here's the what type contains in 

		type = obj->ob_type;
		if (PyType_HasFeature(type, Py_TPFLAGS_HAVE_CLASS) &&
		    type->tp_init != NULL &&
		    type->tp_init(obj, args, kwds) < 0) {
			Py_DECREF(obj);
			obj = NULL;

(gdb) p *obj->ob_type
$10 = {
  ob_refcnt = 5, 
  ob_type = 0x41ce55c0, 
  ob_size = 0, 
  tp_name = 0x401941b4 "Linear", 
  tp_basicsize = 24, 
  tp_itemsize = 1, 
  tp_dealloc = 0x808cab0 <subtype_dealloc>, 
  tp_print = 0, 
  tp_getattr = 0, 
  tp_setattr = 0, 
  tp_compare = 0, 
  tp_repr = 0x808d910 <object_repr>, 
  tp_as_number = 0x819e28c, 
  tp_as_sequence = 0x819e330, 
  tp_as_mapping = 0x819e324, 
  tp_hash = 0x808dbc0 <object_hash>, 
  tp_call = 0, 
  tp_str = 0x808db90 <object_str>, 
  tp_getattro = 0x8080940 <PyObject_GenericGetAttr>, 
  tp_setattro = 0x8080c00 <PyObject_GenericSetAttr>, 
  tp_as_buffer = 0x819e358, 
  tp_flags = 22523, 
  tp_doc = 0x0, 
  tp_traverse = 0x808c8c0 <subtype_traverse>, 
  tp_clear = 0x808ca00 <subtype_clear>, 
  tp_richcompare = 0, 
  tp_weaklistoffset = 16, 
  tp_iter = 0, 
  tp_iternext = 0, 
  tp_methods = 0x0, 
  tp_members = 0x819e370, 
  tp_getset = 0x0, 
  tp_base = 0x862f4e4, 
  tp_dict = 0x4060835c, 
  tp_descr_get = 0, 
  tp_descr_set = 0, 
  tp_dictoffset = 12, 
  tp_init = 0x80949a0 <slot_tp_init>, 
  tp_alloc = 0x808c7a0 <PyType_GenericAlloc>, 
  tp_new = 0x41cc9ca0 <boost::python::instance_holder::install(_object*)+32>, 
  tp_free = 0x80eb2c0 <PyObject_GC_Del>, 
  tp_is_gc = 0, 
  tp_bases = 0x401a3ecc, 
  tp_mro = 0x4019320c, 
  tp_cache = 0x0, 
  tp_subclasses = 0x0, 
  tp_weaklist = 0x40600edc, 
  tp_del = 0
}

   I don't know what is good or bad in the above.   Maybe someone
does.



More information about the Cplusplus-sig mailing list