[New-bugs-announce] [issue17673] add `copy_from` argument to temporaryfile

Antoine Pitrou report at bugs.python.org
Tue Apr 9 12:19:58 CEST 2013

New submission from Antoine Pitrou:

It is sometimes useful to create a temporary file as a copy of an existing file (especially e.g. in tests, when you want to mutate the temp file but not the original). I would suggest adding a `copy_from` argument to TemporaryFile and NamedTemporaryFile, which is either the path to an existing file or a file-like object. Then the contents of that source file are copied to the tempfile before it is yielded.

components: Library (Lib)
messages: 186392
nosy: ncoghlan, pitrou
priority: normal
severity: normal
status: open
title: add `copy_from` argument to temporaryfile
type: enhancement
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list