mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Manual py3k backport: [svn r74155] Issue #6242: Fix deallocator of io.StringIO and io.BytesIO
This commit is contained in:
parent
5f029ce664
commit
f98a267be3
3 changed files with 17 additions and 6 deletions
|
@ -616,11 +616,14 @@ bytesio_close(bytesio *self)
|
|||
static void
|
||||
bytesio_dealloc(bytesio *self)
|
||||
{
|
||||
_PyObject_GC_UNTRACK(self);
|
||||
if (self->buf != NULL) {
|
||||
PyMem_Free(self->buf);
|
||||
self->buf = NULL;
|
||||
}
|
||||
Py_TYPE(self)->tp_clear((PyObject *)self);
|
||||
Py_CLEAR(self->dict);
|
||||
if (self->weakreflist != NULL)
|
||||
PyObject_ClearWeakRefs((PyObject *) self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
|
@ -674,7 +677,6 @@ static int
|
|||
bytesio_traverse(bytesio *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(self->dict);
|
||||
Py_VISIT(self->weakreflist);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -682,8 +684,6 @@ static int
|
|||
bytesio_clear(bytesio *self)
|
||||
{
|
||||
Py_CLEAR(self->dict);
|
||||
if (self->weakreflist != NULL)
|
||||
PyObject_ClearWeakRefs((PyObject *)self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue