[Python-checkins] r69314 - sandbox/trunk/dbm_sqlite/alt/dbdict.py

Nick Coghlan ncoghlan at gmail.com
Fri Feb 6 09:50:31 CET 2009


raymond.hettinger wrote:
> Author: raymond.hettinger
> Date: Thu Feb  5 23:04:00 2009
> New Revision: 69314
> 
> Log:
> Can't get tempfile to reliably delete on error and persist otherwise.

You work on Windows, don't you Raymond?

What you were trying (setting tf.delete after the file was already open
 but before it was closed) would actually work on non-Windows platforms,
since the delete flag is only checked in the close() method.

On Windows, however, the tempfile code uses the _os.O_TEMPORARY flag at
creation time to tell *Windows* to delete the file when it gets closed.
In that case, writing to the delete attribute has no effect (since the
flag has already been set)

Perhaps the windows special casing should be removed so that the delete
flag on named temporary files can be effectively written to on all
platforms?

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-checkins mailing list