[Python-Dev] New winreg module really an improvement?

Paul Prescod paul@prescod.net
Mon, 07 Aug 2000 08:18:43 -0400


Gordon McMillan wrote:
> 
> ...
> 
> As a practical matter, it looks to me like winreg (under any but
> the most well-informed usage) may well leak handles. If so,
> that would be a disaster. But I don't have time to check it out.

I would be very surprised if that was the case. Perhaps you can outline
your thinking so that *I* can check it out.

I claim that:

_winreg never leaks Windows handles as long _winreg handle objects are
destroyed.

winreg is written entirely in Python and destroys _winreg handles as
long as winreg key objects are destroyed.

winreg key objects are destroyed as long as there is no cycle.

winreg does not create cycles.

Therefore, winreg does not leak handles. I'm 98% confident of each
assertion...for a total confidence of 92%.
-- 
 Paul Prescod - Not encumbered by corporate consensus
"I don't want you to describe to me -- not ever -- what you were doing
to that poor boy to make him sound like that; but if you ever do it
again, please cover his mouth with your hand," Grandmother said.
	-- John Irving, "A Prayer for Owen Meany"