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

jort bloem report at bugs.python.org
Wed Sep 4 22:46:24 CEST 2013


jort bloem added the comment:

I am only new to Python, but...

Having looked at the code, I am surprised that the _TemporaryFileWrapper is not a subclass of "file". Surely that would be the "python" way, and would solve this problem, too? __getattr__ would no longer be needed. The opening of the file is within the library, so _os.open() could be replaced with file()... It would require rewriting/reorganising chunks of this code...

----------

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


More information about the Python-bugs-list mailing list