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

Jakub Stasiak report at bugs.python.org
Thu Sep 5 10:41:53 CEST 2013


Jakub Stasiak added the comment:

I don't see an obvious way of solving that. One thing I could think of is creating a wrapper for file method being returned from __getattr__ that holds reference to _TemporaryFileWrapper instance until the method gets called, please find a patch attached.

----------
keywords: +patch
nosy: +jstasiak
Added file: http://bugs.python.org/file31598/tempfile.patch

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


More information about the Python-bugs-list mailing list