[Python-checkins] r68017 - in python/branches/py3k: Lib/test/test_fileio.py Modules/_fileio.c

benjamin.peterson python-checkins at python.org
Mon Dec 29 19:02:28 CET 2008


Author: benjamin.peterson
Date: Mon Dec 29 19:02:28 2008
New Revision: 68017
Log:
Merged revisions 68016 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk
........
 r68016 | benjamin.peterson | 2008年12月29日 11:56:58 -0600 (2008年12月29日) | 1 line
 
 #4764 in io.open, set IOError.filename when trying to open a directory on POSIX platforms
........
Modified:
 python/branches/py3k/ (props changed)
 python/branches/py3k/Lib/test/test_fileio.py
 python/branches/py3k/Modules/_fileio.c
Modified: python/branches/py3k/Lib/test/test_fileio.py
==============================================================================
--- python/branches/py3k/Lib/test/test_fileio.py	(original)
+++ python/branches/py3k/Lib/test/test_fileio.py	Mon Dec 29 19:02:28 2008
@@ -108,6 +108,7 @@
 _fileio._FileIO('.', 'r')
 except IOError as e:
 self.assertNotEqual(e.errno, 0)
+ self.assertEqual(e.filename, ".")
 else:
 self.fail("Should have raised IOError")
 
Modified: python/branches/py3k/Modules/_fileio.c
==============================================================================
--- python/branches/py3k/Modules/_fileio.c	(original)
+++ python/branches/py3k/Modules/_fileio.c	Mon Dec 29 19:02:28 2008
@@ -116,7 +116,7 @@
 directories, so we need a check. */
 
 static int
-dircheck(PyFileIOObject* self)
+dircheck(PyFileIOObject* self, char *name)
 {
 #if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR)
 	struct stat buf;
@@ -128,8 +128,8 @@
 		if (internal_close(self))
 			return -1;
 
-		exc = PyObject_CallFunction(PyExc_IOError, "(is)",
-					 EISDIR, msg);
+		exc = PyObject_CallFunction(PyExc_IOError, "(iss)",
+					 EISDIR, msg, name);
 		PyErr_SetObject(PyExc_IOError, exc);
 		Py_XDECREF(exc);
 		return -1;
@@ -290,7 +290,7 @@
 #endif
 			goto error;
 		}
-		if(dircheck(self) < 0)
+		if(dircheck(self, name) < 0)
 			goto error;
 	}
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /