[Python-checkins] r85998 - in python/branches/py3k: Misc/NEWS Modules/_io/fileio.c

benjamin.peterson python-checkins at python.org
Sun Oct 31 01:16:29 CEST 2010


Author: benjamin.peterson
Date: Sun Oct 31 01:16:28 2010
New Revision: 85998

Log:
if FileIO.__init__ fails, close fd

Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/_io/fileio.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sun Oct 31 01:16:28 2010
@@ -10,6 +10,8 @@
 Core and Builtins
 -----------------
 
+- If FileIO.__init__ fails, close the file descriptor.
+
 - Issue #10221: dict.pop(k) now has a key error message that includes the
   missing key (same message d[k] returns for missing keys).
 

Modified: python/branches/py3k/Modules/_io/fileio.c
==============================================================================
--- python/branches/py3k/Modules/_io/fileio.c	(original)
+++ python/branches/py3k/Modules/_io/fileio.c	Sun Oct 31 01:16:28 2010
@@ -410,6 +410,8 @@
 
  error:
     ret = -1;
+    if (self->fd >= 0)
+        internal_close(self);
 
  done:
     Py_CLEAR(stringobj);


More information about the Python-checkins mailing list