[PATCH] Fix open_temporary_file_fd

Nathaniel Smith njs at pobox.com
Sun Feb 15 03:33:21 UTC 2004


Attached patch fixes regressions caused by changes to
open_temporary_file_fd.

Okay to apply?  Feels ugly, using the if there, but I guess the
function'll get ripped out entirely when we start assuming Python
2.3...

-- Nathaniel

-- 
.i dei jitfa fanmo xatra

This email may be read aloud.
-------------- next part --------------
? results.qmr
? qm/external/__init__.pyc
? qm/test/classes/dejagnu_tet_stream.py
? tests/regress/QMTest/regression_database.pyc
? tests/regress/QMTest/selftest.pyc
? tests/regress/tuple1/QMTest/tuple_test.pyc
? tests/results_files/QMTest/results_file_database.pyc
? tests/results_files/QMTest/results_file_test.pyc
Index: ChangeLog
===================================================================
RCS file: /home/qm/Repository/qm/ChangeLog,v
retrieving revision 1.603
diff -u -r1.603 ChangeLog
--- ChangeLog	15 Feb 2004 03:20:24 -0000	1.603
+++ ChangeLog	15 Feb 2004 03:28:07 -0000
@@ -1,9 +1,14 @@
 2004-02-14  Nathaniel Smith  <njs at codesourcery.com>
 
+	(open_temporary_file_fd): Pass suffix to mktemp() iff caller
+	provides suffix.
+	
+2004-02-14  Nathaniel Smith  <njs at codesourcery.com>
+
 	* qm/common.py (encode_data_as_text): Remove.
 	(decode_data_from_text): Likewise.
 	(format_byte_count): Likewise.
-	
+
 	(base64): Don't import.
 	(cPickle): Likewise.
 	(cStringIO): Likewise.
Index: qm/common.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/common.py,v
retrieving revision 1.83
diff -u -r1.83 common.py
--- qm/common.py	15 Feb 2004 03:20:24 -0000	1.83
+++ qm/common.py	15 Feb 2004 03:28:07 -0000
@@ -406,7 +406,11 @@
     returns -- A pair '(file_name, file_descriptor)' for the temporary
     file."""
 
-    file_name = tempfile.mktemp(suffix)
+    if suffix is not None:
+        file_name = tempfile.mktemp(suffix)
+    else:
+        file_name = tempfile.mktemp()
+        
     try:
         # Attempt to open the file.
         fd = os.open(file_name,


More information about the qmtest mailing list