[issue32276] there is no way to make tempfile reproducible (i.e. seed the used RNG)

Raymond Hettinger report at bugs.python.org
Sat Dec 16 02:55:51 EST 2017


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

This seems ill-advised:

* If a deterministic filename is needed, tempfile probably shouldn't be used.

* Mock objects are typically used when alternative behavior is needed for testing.

* The proposed feature would preclude a possible future development path to use SystemRandom which wouldn't be able to accept a seed.

* Having the same filename used on successive runs will likely cause other problems. Generally, a user of tempname can assume that filename doesn't already exist and the proposed option would undermine that assumption.

* I suspect if there were a real need here, we would have heard about it a long time ago.  This module is over two decades old.

----------
components: +Library (Lib)
versions: +Python 3.7

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


More information about the Python-bugs-list mailing list