Kaydet (Commit) 2e659ce3 authored tarafından Kristján Valur Jónsson's avatar Kristján Valur Jónsson

Issue 4957

Let os.ftruncate raise OSError like documented.
üst 4b78233c
......@@ -570,10 +570,9 @@ class TestInvalidFD(unittest.TestCase):
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"):
......
......@@ -6633,7 +6633,7 @@ posix_ftruncate(PyObject *self, PyObject *args)
res = ftruncate(fd, length);
Py_END_ALLOW_THREADS
if (res < 0) {
PyErr_SetFromErrno(PyExc_IOError);
posix_error();
return NULL;
}
Py_INCREF(Py_None);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment