if FileIO.__init__ fails, close fd

This commit is contained in:
Benjamin Peterson 2010-10-30 23:16:28 +00:00
parent 430d469758
commit bbb0412ad1
2 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,8 @@ What's New in Python 3.2 Beta 1?
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).

View File

@ -410,6 +410,8 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
error:
ret = -1;
if (self->fd >= 0)
internal_close(self);
done:
Py_CLEAR(stringobj);