summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-01-14 18:31:56 (GMT)
committerGuido van Rossum <guido@python.org>1992-01-14 18:31:56 (GMT)
commitcff3454effbe323b287f95d29329b70adfa22979 (patch)
treec7792200e456d6eab5d743ab1698a4a384c4ce51 /Lib
parenta61ff7b1602d0f94340244bf4504d9eb0faf4ac7 (diff)
downloadcpython-cff3454effbe323b287f95d29329b70adfa22979.zip
cpython-cff3454effbe323b287f95d29329b70adfa22979.tar.gz
cpython-cff3454effbe323b287f95d29329b70adfa22979.tar.bz2
Use $TMPDIR if it is set in the environment.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/tempfile.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index a571f41..793c23f 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -5,11 +5,16 @@ import path
# Changeable parameters (by clients!)...
-# XXX Should the environment variable $TMPDIR override tempdir?
tempdir = '/usr/tmp'
template = '@'
+# Use environment variable $TMPDIR to override default tempdir.
+
+if posix.environ.has_key('TMPDIR'):
+ # XXX Could check that it's a writable directory...
+ tempdir = posix.environ['TMPDIR']
+
# Counter for generating unique names