[issue28387] double free in io.TextIOWrapper

Serhiy Storchaka report at bugs.python.org
Sun Oct 30 05:54:39 EDT 2016


Serhiy Storchaka added the comment:

Thank you for your report and patch Sebastian.

In Python 3 the solution can be simpler, just move the line "_PyObject_GC_UNTRACK(self);" above the line "textiowrapper_clear(self);". But calling PyObject_ClearWeakRefs() also should be moved up. Otherwise half-destroyed TextIOWrapper instance can be accessed via weak references. Following patches do this (and small refactoring).

----------
versions: +Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45274/textiowrapper_clear-3.5.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28387>
_______________________________________


More information about the Python-bugs-list mailing list