[New-bugs-announce] [issue18879] tempfile.NamedTemporaryFile can close the file too early, if not assigning to a variable

jort bloem report at bugs.python.org
Thu Aug 29 22:25:43 CEST 2013


New submission from jort bloem:

Issue occurs in the following code: tempfile.NamedTemporaryFile(dir=".",delete=False).write("hello")

The NamedTemporaryFile is deleted before the write is complete; deleting the object closes the file, so the write fails.

----------
messages: 196485
nosy: jort.bloem
priority: normal
severity: normal
status: open
title: tempfile.NamedTemporaryFile can close the file too early, if not assigning to a variable
type: behavior
versions: Python 2.6, Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18879>
_______________________________________


More information about the New-bugs-announce mailing list