summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-05-26 19:05:16 (GMT)
committerFred Drake <fdrake@acm.org>2000-05-26 19:05:16 (GMT)
commit0233075fce3201dfe21330964c6879bd6fc36c0d (patch)
tree6cf402419dc29eafe51e181fd9a8a0ef0535cd89 /Doc
parent675ac285aed98a080b3692db78370ff59e7c03ae (diff)
downloadcpython-0233075fce3201dfe21330964c6879bd6fc36c0d.zip
cpython-0233075fce3201dfe21330964c6879bd6fc36c0d.tar.gz
cpython-0233075fce3201dfe21330964c6879bd6fc36c0d.tar.bz2
Added documentation for TemporaryFile() and the siffix parameter to mktemp().
Removed obsolete comments about this module not creating or removing actual files. Removed obsolete comment about users needing to set template to None after calling os.fork().
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libtempfile.tex39
1 files changed, 26 insertions, 13 deletions
diff --git a/Doc/lib/libtempfile.tex b/Doc/lib/libtempfile.tex
index b8f1e69..d3921bd 100644
--- a/Doc/lib/libtempfile.tex
+++ b/Doc/lib/libtempfile.tex
@@ -11,15 +11,35 @@
This module generates temporary file names. It is not \UNIX{} specific,
but it may require some help on non-\UNIX{} systems.
-Note: the modules does not create temporary files, nor does it
-automatically remove them when the current process exits or dies.
+The module defines the following user-callable functions:
-The module defines a single user-callable function:
-
-\begin{funcdesc}{mktemp}{}
+\begin{funcdesc}{mktemp}{\optional{suffix}}
Return a unique temporary filename. This is an absolute pathname of a
file that does not exist at the time the call is made. No two calls
-will return the same filename.
+will return the same filename. \var{suffix}, if provided, is used as
+the last part of the generated file name. This can be used to provide
+a filename extension or other identifying information that may be
+useful on some platforms.
+\end{funcdesc}
+
+\begin{funcdesc}{TemporaryFile}{\optional{mode\optional{,
+ bufsize\optional{, suffix}}}}
+Return a file (or file-like) object that can be used as a temporary
+storage area. The file is created in the most secure manner available
+in the appporpriate temporary directory for the host platform. Under
+\UNIX, the directory entry to the file is removed so that it is secure
+against attacks which involve creating symbolic links to the file or
+replacing the file with a symbolic link to some other file. For other
+platforms, which don't allow removing the directory entry while the
+file is in use, the file is automatically deleted as soon as it is
+closed (including an implicit close when it is garbage-collected).
+
+The \var{mode} parameter defaults to \code{'w+b'} so that the file
+created can be read and written without being closed. Binary mode is
+used so that it behaves consistently on all platforms without regard
+for the data that is stored. \var{bufsize} defaults to \code{-1},
+meaning that the operating system default is used. \var{suffix} is
+passed to \function{mktemp()}.
\end{funcdesc}
The module uses two global variables that tell it how to construct a
@@ -43,10 +63,3 @@ unique filenames. The default is either \file{@\var{pid}.} where
\var{pid} is the current process ID (on \UNIX{}), or \file{tmp} (all
other systems).
\end{datadesc}
-
-\strong{Warning:} if a \UNIX{} process uses \code{mktemp()}, then
-calls \function{fork()} and both parent and child continue to use
-\function{mktemp()}, the processes will generate conflicting temporary
-names. To resolve this, the child process should assign \code{None} to
-\code{template}, to force recomputing the default on the next call
-to \function{mktemp()}.
cm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-s60axis2010-03-181-1/+4 |\ \ | |/ | * Set PM_MenuScrollerHeight to zeroSami Merila2010-03-171-1/+4 * | Update src/3rdparty/javascriptcore and adapt src/script to the changesKent Hansen2010-03-101-1/+6 * | Fix the code after merge: DerivedNormalizationProps has two or more columnsThiago Macieira2010-03-051-1/+1 * | add some usefull definitions to qunicodetables_p.hRitt Konstantin2010-03-051-2/+3 * | finish last commitRitt Konstantin2010-03-051-3/+4 * | prefer DerivedNormalizationProps.txt over CompositionExclusions.txtRitt Konstantin2010-03-052-208/+28 * | improve error reporting a bit moreRitt Konstantin2010-03-051-1/+8 * | improve error reportingRitt Konstantin2010-03-051-0/+8 * | fix incorect conditionRitt Konstantin2010-03-051-1/+1 * | check if string to int conversions were done w/o errorsRitt Konstantin2010-03-051-3/+18 * | improve error reporting for unassigned grapheme/word/sentence break classesRitt Konstantin2010-03-051-8/+18 * | avoid using of qunicodetables_p.h in generatorRitt Konstantin2010-03-051-1/+3 * | use QHash for line break mapRitt Konstantin2010-03-051-45/+74 * | use QHash for age mapRitt Konstantin2010-03-051-26/+29 * | minor clean-upsRitt Konstantin2010-03-051-42/+44 * | generate specialCaseMap as set of human-readable code-sequencesRitt Konstantin2010-03-051-3/+3 * | make sure that the sequences in specialCaseMap are uniqueRitt Konstantin2010-03-051-1/+1 * | Unicode character property 'General_Category=Cn' was erroneously ignoredRitt Konstantin2010-03-051-1/+1 * | fix some 0x10000 codepoint -related issuesRitt Konstantin2010-03-051-10/+8 * | minor cleanups and styling fixes for generator and generated codeRitt Konstantin2010-03-051-92/+98 * | apply some (forgotten) changes to generator as they were applied to the dataRitt Konstantin2010-03-051-3/+9 * | adjust unicode tables generator to work better under winRitt Konstantin2010-03-052-0/+2 * | Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master...Qt Continuous Integration System2010-02-251-0/+2650 |\ \ | * | Add the Unicode normalisation properties.Thiago Macieira2010-02-241-0/+2650 | |/ * | Adjust the mkdist-webkit script before the importation of WebKit.Jocelyn Turcotte2010-02-231-12/+24 |/ * generate code which does not break QT_USE_FAST_CONCATENATION with old gccOswald Buddenhagen2010-02-08