[Python-Dev] use PyCObject (was: CVS: python/dist/src/PC msvcrtmodule.c,1.4,1.5 _winreg.c,1.5,1.6)

Greg Stein gstein@lyra.org
Sat, 1 Jul 2000 02:09:23 -0700


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.

Cheers,
-g

On Fri, Jun 30, 2000 at 10:48:54AM -0700, Fred L. Drake wrote:
> Update of /cvsroot/python/python/dist/src/PC
> In directory slayer.i.sourceforge.net:/tmp/cvs-serv11047/PC
> 
> Modified Files:
> 	msvcrtmodule.c _winreg.c 
> Log Message:
> [*** Not tested as I don't have Windows running right now! ***]
> 
> Trent Mick <trentm@activestate.com>:
> 
> Fix PC/msvcrtmodule.c and PC/winreg.c for Win64. Basically: 
> 
> - sizeof(HKEY) > sizeof(long) on Win64, so use PyLong_FromVoidPtr()
> instead of PyInt_FromLong() to return HKEY values on Win64
> 
> - Check for string overflow of an arbitrary registry value (I know
> that ensuring that a registry value does not overflow 2**31 characters
> seems ridiculous but it is *possible*).
> 
> Closes SourceForge patch #100517.
>...

-- 
Greg Stein, http://www.lyra.org/