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
given empty data twice. Patch by Benjamin Fogle.
}
static int
-_textiowrapper_clear(textio *self)
+textiowrapper_clear(textio *self)
{
self->ok = 0;
Py_CLEAR(self->buffer);
Py_CLEAR(self->snapshot);
Py_CLEAR(self->errors);
Py_CLEAR(self->raw);
+
+ Py_CLEAR(self->dict);
return 0;
}
self->finalizing = 1;
if (_PyIOBase_finalize((PyObject *) self) < 0)
return;
- _textiowrapper_clear(self);
+ self->ok = 0;
_PyObject_GC_UNTRACK(self);
if (self->weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *)self);
- Py_CLEAR(self->dict);
+ textiowrapper_clear(self);
Py_TYPE(self)->tp_free((PyObject *)self);
}
return 0;
}
-static int
-textiowrapper_clear(textio *self)
-{
- if (_textiowrapper_clear(self) < 0)
- return -1;
- Py_CLEAR(self->dict);
- return 0;
-}
-
static PyObject *
textiowrapper_closed_get(textio *self, void *context);