Patch by tg@FreeBSD.org to try /var/tmp first.
This helps on 4.4BSD-based systems.
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index eef6bff..5077835 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -23,7 +23,7 @@
         pwd = os.getcwd()
     except (AttributeError, os.error):
         pwd = os.curdir
-    attempdirs = ['/usr/tmp', '/tmp', pwd]
+    attempdirs = ['/var/tmp', '/usr/tmp', '/tmp', pwd]
     if os.name == 'nt':
         attempdirs.insert(0, 'C:\\TEMP')
         attempdirs.insert(0, '\\TEMP')