Steve Dower <steve.do...@python.org> added the comment:

O_TEMPORARY is clearly not the right option here, and we should just move the 
unlink call into __exit__ and attempt it even if close() has been called.

Windows's "delete on close" functionality is great, but if you haven't designed 
for its semantics, it's unusable. And this library is not designed for it, so 
users can't rely on the native functionality.

So we stop passing the O_TEMPORARY flag. If __enter__() is called, close() 
closes the file but doesn't delete anything, and __exit__() closes the file (if 
open) and deletes it (even if it wasn't open). If there is no __enter__(), 
close() also deletes the file.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue14243>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to