Charles-François Natali <neolo...@free.fr> added the comment:

Confirmed with default.
The problem is that the TextIOWrapper gets collected after the underlying 
BufferedRWPair has been cleared (tp_clear) by the garbage collector: when 
_PyIOBase_finalize() is called for the TextIOWrapper, it checks if the textio 
is closed, which indirectly checks if the underlying rwpair is closed:
"""
static PyObject *
bufferedrwpair_closed_get(rwpair *self, void *context)
{
    return PyObject_GetAttr((PyObject *) self->writer, _PyIO_str_closed);
}
"""

Since self->writer has already been set to NULL by bufferedrwpair_clear(), 
PyObject_GetAttr() segfaults.

@Victor
Could you try the patch attached?

----------
keywords: +patch
nosy: +amaury.forgeotdarc, neologix, pitrou
versions: +Python 3.3
Added file: http://bugs.python.org/file23277/buffered_closed_gc.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13070>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to