[Python-checkins] r68763 - in python/trunk: Lib/test/test_os.py Modules/posixmodule.c

kristjan.jonsson python-checkins at python.org
Mon Jan 19 14:10:27 CET 2009


Author: kristjan.jonsson
Date: Mon Jan 19 14:10:27 2009
New Revision: 68763

Log:
Issue 4957
Let os.ftruncate raise OSError like documented.

Modified:
   python/trunk/Lib/test/test_os.py
   python/trunk/Modules/posixmodule.c

Modified: python/trunk/Lib/test/test_os.py
==============================================================================
--- python/trunk/Lib/test/test_os.py	(original)
+++ python/trunk/Lib/test/test_os.py	Mon Jan 19 14:10:27 2009
@@ -570,10 +570,9 @@
         if hasattr(os, "fpathconf"):
             self.assertRaises(OSError, os.fpathconf, 10, "PC_NAME_MAX")
 
-    #this is a weird one, it raises IOError unlike the others
     def test_ftruncate(self):
         if hasattr(os, "ftruncate"):
-            self.assertRaises(IOError, os.ftruncate, 10, 0)
+            self.assertRaises(OSError, os.ftruncate, 10, 0)
 
     def test_lseek(self):
         if hasattr(os, "lseek"):

Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c	(original)
+++ python/trunk/Modules/posixmodule.c	Mon Jan 19 14:10:27 2009
@@ -6633,7 +6633,7 @@
 	res = ftruncate(fd, length);
 	Py_END_ALLOW_THREADS
 	if (res < 0) {
-		PyErr_SetFromErrno(PyExc_IOError);
+		posix_error();
 		return NULL;
 	}
 	Py_INCREF(Py_None);


More information about the Python-checkins mailing list