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

Yaroslav Halchenko report at bugs.python.org
Mon Dec 11 09:25:27 EST 2017


New submission from Yaroslav Halchenko <yarikoptic at gmail.com>:

It is quite often desired to reproduce the same failure identically. In many cases sufficient to seed the shared random._inst (via random.seed). tempfile creates new instance(s) for its own operation and does not provide API to seed it.  I do not think it would be easy (unless I miss some pattern) to make it deterministic/reproducible for multi-process apps, but I wondered why initially (for the main process) tempfile module doesn't just reuse the random._inst while only creating a new _Random in children processes?
Another alternative solution would be to allow to specify seed for all those mkstemp/mkdtemp/... and pass it all way to _RandomNameSequence which would initialize _Random with it.  This way, developers who need to seed it, could do so

----------
messages: 308043
nosy: Yaroslav.Halchenko
priority: normal
severity: normal
status: open
title: there is no way to make tempfile reproducible (i.e. seed the used RNG)

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


More information about the New-bugs-announce mailing list