mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Only release buffer after file has been closed. Fixes #800824.
Will backport to 2.2.
This commit is contained in:
parent
ee8f10fa37
commit
7bbcde70d1
1 changed files with 1 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue