[Python-checkins] r68780 - in python/branches/py3k: Lib/test/test_os.py Modules/posixmodule.c
benjamin.peterson
python-checkins at python.org
Mon Jan 19 18:53:36 CET 2009
Author: benjamin.peterson
Date: Mon Jan 19 18:53:36 2009
New Revision: 68780
Log:
Merged revisions 68763,68773 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68763 | kristjan.jonsson | 2009-01-19 07:10:27 -0600 (Mon, 19 Jan 2009) | 2 lines
Issue 4957
Let os.ftruncate raise OSError like documented.
........
r68773 | benjamin.peterson | 2009-01-19 09:51:27 -0600 (Mon, 19 Jan 2009) | 1 line
simplify code
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/test/test_os.py
python/branches/py3k/Modules/posixmodule.c
Modified: python/branches/py3k/Lib/test/test_os.py
==============================================================================
--- python/branches/py3k/Lib/test/test_os.py (original)
+++ python/branches/py3k/Lib/test/test_os.py Mon Jan 19 18:53:36 2009
@@ -624,10 +624,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/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c (original)
+++ python/branches/py3k/Modules/posixmodule.c Mon Jan 19 18:53:36 2009
@@ -5114,10 +5114,8 @@
Py_BEGIN_ALLOW_THREADS
res = ftruncate(fd, length);
Py_END_ALLOW_THREADS
- if (res < 0) {
- PyErr_SetFromErrno(PyExc_IOError);
- return NULL;
- }
+ if (res < 0)
+ return posix_error();
Py_INCREF(Py_None);
return Py_None;
}
More information about the Python-checkins
mailing list