Martin Panter added the comment:
Eryk Sun: The patch proposes to add an unlink() call after the file has been
closed:
except Exception:
_os.close(fd) # This automatically deletes the file right?
_os.unlink(name) # Won’t this raise FileNotFoundError?
raise
By your explanation, it sounds like it would be better to call unlink() before
close().
Terry & Victor: Writing the explicit “except BaseException:” makes it clear you
weren’t being lazy in figuring out what exceptions you want to catch. But in
this case the “raise” at the end of the the exception handler make it clear
enough for me. I would be happy with either option.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26385>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com