mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Closes #15488: Closed files keep their buffer alive
This commit is contained in:
parent
279ed3cc55
commit
dc469454ec
3 changed files with 16 additions and 0 deletions
|
@ -519,6 +519,11 @@ buffered_close(buffered *self, PyObject *args)
|
|||
|
||||
res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_close, NULL);
|
||||
|
||||
if (self->buffer) {
|
||||
PyMem_Free(self->buffer);
|
||||
self->buffer = NULL;
|
||||
}
|
||||
|
||||
end:
|
||||
LEAVE_BUFFERED(self)
|
||||
return res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue