[Python-checkins] r86024 - in python/branches/release31-maint: Lib/test/test_fileio.py Misc/NEWS Modules/_io/fileio.c
antoine.pitrou
python-checkins at python.org
Sun Oct 31 14:05:21 CET 2010
Author: antoine.pitrou
Date: Sun Oct 31 14:05:21 2010
New Revision: 86024
Log:
Merged revisions 85982 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85982 | antoine.pitrou | 2010-10-30 18:19:14 +0200 (sam., 30 oct. 2010) | 4 lines
Issue #10253: FileIO leaks a file descriptor when trying to open a file
for append that isn't seekable. Patch by Brian Brazil.
........
Modified:
python/branches/release31-maint/ (props changed)
python/branches/release31-maint/Lib/test/test_fileio.py
python/branches/release31-maint/Misc/NEWS
python/branches/release31-maint/Modules/_io/fileio.c
Modified: python/branches/release31-maint/Lib/test/test_fileio.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_fileio.py (original)
+++ python/branches/release31-maint/Lib/test/test_fileio.py Sun Oct 31 14:05:21 2010
@@ -342,6 +342,7 @@
f.truncate(15)
self.assertEqual(f.tell(), 5)
self.assertEqual(f.seek(0, os.SEEK_END), 15)
+ f.close()
def testTruncateOnWindows(self):
def bug801631():
Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS (original)
+++ python/branches/release31-maint/Misc/NEWS Sun Oct 31 14:05:21 2010
@@ -143,6 +143,9 @@
Library
-------
+- Issue #10253: FileIO leaks a file descriptor when trying to open a file
+ for append that isn't seekable. Patch by Brian Brazil.
+
- Issue #5027: The standard ``xml`` namespace is now understood by
xml.sax.saxutils.XMLGenerator as being bound to
http://www.w3.org/XML/1998/namespace. Patch by Troy J. Farrell.
Modified: python/branches/release31-maint/Modules/_io/fileio.c
==============================================================================
--- python/branches/release31-maint/Modules/_io/fileio.c (original)
+++ python/branches/release31-maint/Modules/_io/fileio.c Sun Oct 31 14:05:21 2010
@@ -364,8 +364,13 @@
end of file (otherwise, it might be done only on the
first write()). */
PyObject *pos = portable_lseek(self->fd, NULL, 2);
- if (pos == NULL)
+ if (pos == NULL) {
+ if (closefd) {
+ close(self->fd);
+ self->fd = -1;
+ }
goto error;
+ }
Py_DECREF(pos);
}
More information about the Python-checkins
mailing list