mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when
the garbage collector is invoked in other thread. Based on patch by Sebastian Cufre.
This commit is contained in:
commit
d63f1f757c
3 changed files with 10 additions and 12 deletions
|
@ -321,6 +321,7 @@ Felipe Cruz
|
||||||
Drew Csillag
|
Drew Csillag
|
||||||
Alessandro Cucci
|
Alessandro Cucci
|
||||||
Joaquin Cuenca Abela
|
Joaquin Cuenca Abela
|
||||||
|
Sebastian Cufre
|
||||||
John Cugini
|
John Cugini
|
||||||
Tom Culliton
|
Tom Culliton
|
||||||
Raúl Cumplido
|
Raúl Cumplido
|
||||||
|
|
|
@ -106,6 +106,10 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when
|
||||||
|
the garbage collector is invoked in other thread. Based on patch by
|
||||||
|
Sebastian Cufre.
|
||||||
|
|
||||||
- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if
|
- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if
|
||||||
given empty data twice. Patch by Benjamin Fogle.
|
given empty data twice. Patch by Benjamin Fogle.
|
||||||
|
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_textiowrapper_clear(textio *self)
|
textiowrapper_clear(textio *self)
|
||||||
{
|
{
|
||||||
self->ok = 0;
|
self->ok = 0;
|
||||||
Py_CLEAR(self->buffer);
|
Py_CLEAR(self->buffer);
|
||||||
|
@ -1116,6 +1116,8 @@ _textiowrapper_clear(textio *self)
|
||||||
Py_CLEAR(self->snapshot);
|
Py_CLEAR(self->snapshot);
|
||||||
Py_CLEAR(self->errors);
|
Py_CLEAR(self->errors);
|
||||||
Py_CLEAR(self->raw);
|
Py_CLEAR(self->raw);
|
||||||
|
|
||||||
|
Py_CLEAR(self->dict);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1125,11 +1127,11 @@ textiowrapper_dealloc(textio *self)
|
||||||
self->finalizing = 1;
|
self->finalizing = 1;
|
||||||
if (_PyIOBase_finalize((PyObject *) self) < 0)
|
if (_PyIOBase_finalize((PyObject *) self) < 0)
|
||||||
return;
|
return;
|
||||||
_textiowrapper_clear(self);
|
self->ok = 0;
|
||||||
_PyObject_GC_UNTRACK(self);
|
_PyObject_GC_UNTRACK(self);
|
||||||
if (self->weakreflist != NULL)
|
if (self->weakreflist != NULL)
|
||||||
PyObject_ClearWeakRefs((PyObject *)self);
|
PyObject_ClearWeakRefs((PyObject *)self);
|
||||||
Py_CLEAR(self->dict);
|
textiowrapper_clear(self);
|
||||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1151,15 +1153,6 @@ textiowrapper_traverse(textio *self, visitproc visit, void *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
textiowrapper_clear(textio *self)
|
|
||||||
{
|
|
||||||
if (_textiowrapper_clear(self) < 0)
|
|
||||||
return -1;
|
|
||||||
Py_CLEAR(self->dict);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
textiowrapper_closed_get(textio *self, void *context);
|
textiowrapper_closed_get(textio *self, void *context);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue