Message70826
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. |
|
Date |
User |
Action |
Args |
2008-08-07 13:49:15 | ocean-city | set | recipients:
+ ocean-city, gregory.p.smith, gjb1002, tim.golden |
2008-08-07 13:49:15 | ocean-city | set | messageid: <1218116955.34.0.660982119668.issue3210@psf.upfronthosting.co.za> |
2008-08-07 13:49:14 | ocean-city | link | issue3210 messages |
2008-08-07 13:49:14 | ocean-city | create | |
|