Author ocean-city
Recipients gjb1002, gregory.p.smith, ocean-city, tim.golden
Date 2008-08-07.13:49:13
SpamBayes Score 5.54139e-08
Marked as misclassified No
Message-id <1218116955.34.0.660982119668.issue3210@psf.upfronthosting.co.za>
In-reply-to
Content
Hello. I had lecture about exception & frames on issue3515.

When Lib/subprocess.py (814)'s CreateProcess() raises exception,
p2cread will be freed by refcount GC, but it never happen before
os.remove() because sys.exc_traceback holds reference to frame
which has p2cread.

import subprocess, os

file = open("filename", "w")
try:
    proc = subprocess.Popen("nosuchprogram", stdout=file)
except OSError:
    pass

try:
    raise RuntimeError() # hack to clear previous exc_traceback
except:
    pass

file.close()
os.remove("filename") # runs fine

So, I think subprocess module's practice which relys on refcount GC
is not good. (p2cread is PC/_subprocess.c 's sp_handle_object, so
automatically freed by refcount GC) I don't think attached "adhok.patch"
is enough, but seems to fix this issue at least.
History
Date User Action Args
2008-08-07 13:49:15ocean-citysetrecipients: + ocean-city, gregory.p.smith, gjb1002, tim.golden
2008-08-07 13:49:15ocean-citysetmessageid: <1218116955.34.0.660982119668.issue3210@psf.upfronthosting.co.za>
2008-08-07 13:49:14ocean-citylinkissue3210 messages
2008-08-07 13:49:14ocean-citycreate