[Python-Dev] use PyCObject (was: CVS: python/dist/src/PC msvcrtmodule.c,1.4,1.5 _winreg.c,1.5,1.6)
Sat, 1 Jul 2000 06:51:11 -0700
On Sat, Jul 01, 2000 at 11:23:21PM +1000, Mark Hammond wrote:
> > While I'm very glad that I suggested PyLong_FromVoidPtr() for issues like
> > this, I think that returning an HKEY should probably use a PyCObject. You
> > will then be able to supply a "free" function that can close the HKEY.
> This is exactly what we do. Trents patches are just for the functions that
> return the underlying handle value as an integer (which is definately a
> useful thing to be able to do!)
But I don't understand why you want an integer. From the Python programmer's
standpoint, they just want a handle, right?
The safety of having the "free" function is quite nice. Without it, it would
seem to be "easy" to leak handles.
Without using PyCObject, we'd need a complete handle type (like the one in
win32api or wherever).
Greg Stein, http://www.lyra.org/