[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

Evgeny report at bugs.python.org
Fri Apr 30 13:21:44 EDT 2021


Evgeny <ev2geny at gmail.com> added the comment:

>Eryk Sun <eryksun at gmail.com> added the comment:

>I replied twice that I thought using the CM exit instead of O_TEMPORARY is okay for NamedTemporaryFile() -- but only if a separate implementation of TemporaryFile() that uses O_TEMPORARY is added at the same time. I want guaranteed cleanup for TemporaryFile() since it's not intended to be reopened.

At the moment, the TemporaryFile directly reuses NamedTemporaryFile for none-posix or cygwin systems.

https://github.com/python/cpython/blob/a92d7387632de1fc64de51f22f6191acd0c6f5c0/Lib/tempfile.py#L552

Does it mean, that your suggestion to leave the O_TEMPORARY for TemporaryFile means, that NamedTemporaryFile needs to have a mechanism to know whether it was called as a TemporaryFile and then to have a different functionality in this case relative to the situation it would be called directly?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue14243>
_______________________________________


More information about the Python-bugs-list mailing list