[New-bugs-announce] [issue26362] Approved API for creating a temporary file path

Ben Finney report at bugs.python.org
Sun Feb 14 21:11:11 EST 2016

New submission from Ben Finney:

The security issues of `tempfile.mktemp` are clear when the return value is used to create a filesystem entry. The documentation and docstrings (and even some comments on past issues) are correct o deprecate its use for that purpose.

The function has a use which doers not have security implications: generating test data. When a test case wants to generate unpredictable, unique, valid filesystem paths – and *never access those paths* on the filesystem – the `tempfile.mktemp` function is right there and is very useful.

The `tempfile._RandomNameSequence` class would also be useful, but its name also makes clear that it is not part of the library public API.

Please make that functionality available for the purpose of *only* generating filesystem paths as `tempfile._RandomNameSequence` does, in a public, supported, non-deprecated API.

components: Library (Lib)
messages: 260291
nosy: bignose
priority: normal
severity: normal
status: open
title: Approved API for creating a temporary file path
type: behavior
versions: Python 3.5, Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list