Hirokazu Yamamoto <[EMAIL PROTECTED]> added the comment: 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. ---------- keywords: +patch Added file: http://bugs.python.org/file11068/adhok.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3210> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com