[issue14243] NamedTemporaryFile unusable under Windows

Dave Abrahams report at bugs.python.org
Sun Mar 11 04:30:16 CET 2012

Dave Abrahams <dave at boostpro.com> added the comment:

If file.close() "offers deterministic resource management," then you have to consider the file's open/closed state to be a resource separate from its existence.  A NamedTemporaryFile whose close() deterministically managed the open/closed state but not the existence of the file would be consistent with file.  That said, I understand the move toward deprecating (in the informal sense) cleanups that rely on GC.

I'm not suggesting breaking backward compatibility, either.  I'm suggesting that it might make sense to allow an explicit close-without-delete as an /extension/ of the current interface.  Given the move away from GC-cleanups, you'd probably want an explicit unlink() method as well in that case.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list