Author ocean-city
Recipients gjb1002, gregory.p.smith, markmentovai, ocean-city, tim.golden, twhitema
Date 2009-10-09.12:14:04
SpamBayes Score 2.13186e-06
Marked as misclassified No
Message-id <1255090446.57.0.453011167358.issue3210@psf.upfronthosting.co.za>
In-reply-to
Content
No, this is not duplicate of issue5179. That issue described handle was
leaked when exception occurred. But this issue is not *leak*. See
following code.

import subprocess, os, sys
file = open("filename", "w")
try:
    proc = subprocess.Popen("nosuchprogram", stdout=file)
except OSError:
    file.close()
    sys.exc_clear() # here we go....
    os.remove("filename") # now we can delete file!

subprocess is implemented using sp_handle_type in PC/_subprocess.c
(windows). This object is in exception stack frame(?), so handle lives
until another exception occurs or explicitly sys.exc_clear() is called.
History
Date User Action Args
2009-10-09 12:14:06ocean-citysetrecipients: + ocean-city, gregory.p.smith, gjb1002, tim.golden, twhitema, markmentovai
2009-10-09 12:14:06ocean-citysetmessageid: <1255090446.57.0.453011167358.issue3210@psf.upfronthosting.co.za>
2009-10-09 12:14:05ocean-citylinkissue3210 messages
2009-10-09 12:14:04ocean-citycreate