Only release buffer after file has been closed. Fixes #800824.
Will backport to 2.2.
This commit is contained in:
parent
ee8f10fa37
commit
7bbcde70d1
|
@ -388,7 +388,6 @@ static PyObject *
|
|||
file_close(PyFileObject *f)
|
||||
{
|
||||
int sts = 0;
|
||||
PyMem_Free(f->f_setbuf);
|
||||
if (f->f_fp != NULL) {
|
||||
if (f->f_close != NULL) {
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
@ -398,6 +397,7 @@ file_close(PyFileObject *f)
|
|||
}
|
||||
f->f_fp = NULL;
|
||||
}
|
||||
PyMem_Free(f->f_setbuf);
|
||||
if (sts == EOF)
|
||||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
if (sts != 0)
|
||||
|
|
Loading…
Reference in New Issue