[capi-sig] Raise an error when PyObject_New is used with Py_TPFLAGS_HAVE_GC

Duncan Webb duncan-py at linuxowl.com
Wed Aug 27 21:21:17 CEST 2008


Hi all,

I was happily using PyObject_New instead of PyObject_GC_New with flags 
containing Py_TPFLAGS_HAVE_GC during development of some bindings. The 
module was working just fine with the debug build. As soon as building a 
release build things started to crash and it took me about five days to 
figure this one out. The reason is GC decrements a counter which does 
not affect debug build too much but does decrement the address of a 
tuple in release builds.

Do you think that an error could be raised when the incorrect New is 
used with or without the Py_TPFLAGS_HAVE_GC set?

Previously I fixed up pygoom (for Freevo) to work bit I'm a bit of a 
newbee to writing C extensions from scratch. These bindings are to 
monitor and control Orbacus CORBA servers.

Thanks,
Duncan


More information about the capi-sig mailing list