[Python-bugs-list] [ python-Bugs-476138 ] tempfile behavior across platforms (original) (raw)
noreply@sourceforge.net noreply@sourceforge.net
Mon, 29 Oct 2001 13:14:29 -0800
- Previous message: [Python-bugs-list] [ python-Bugs-476129 ] gc.collect sometimes hangs
- Next message: [Python-bugs-list] [ python-Bugs-476138 ] tempfile behavior across platforms
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bugs item #476138, was opened at 2001-10-29 13:14 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=476138&group_id=5470
Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Jeremy Hylton (jhylton) Assigned to: Nobody/Anonymous (nobody) Summary: tempfile behavior across platforms
Initial Comment: The object returned by TemporaryFile.tempfile() has a close() method. On Unix, this is a builtin file object's close method. On Windows, it is a TemporaryFileWrapper object's close method.
The two have different semantics, which limits the utility of the module in code that should run on both platforms. There are two differences:
The close() method on Windows unlinks the file after closing it. The close() method on Unix does not.
Calling close() on a closed tempfile raises an exception on Windows, but has no effect on Unix. (This is a consequence of the previous difference. The second attempt to unlink the file fails.)
I think the sensible fix is to catch and ignore failed unlink calls on Windows.
You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=476138&group_id=5470
- Previous message: [Python-bugs-list] [ python-Bugs-476129 ] gc.collect sometimes hangs
- Next message: [Python-bugs-list] [ python-Bugs-476138 ] tempfile behavior across platforms
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]