Charles-François Natali <[email protected]> added the comment:
> Shouldn't the test use "self.BufferedRWPair" instead of
> "io.BufferedRWPair"?
Yes.
> Also, is it ok to just return NULL or should the error state also be
> set?
Well, I'm not sure, that why I made you and Amaury noisy :-)
AFAICT, this is the only case where _check_closed can encounter a NULL
self->writer. And this specific situation is not an error (nothing prevents the
rwpair from being garbaged collected before the textio) ,and
_PyIOBase_finalize() explicitely clears any error returned:
"""
/* If `closed` doesn't exist or can't be evaluated as bool, then the
object is probably in an unusable state, so ignore. */
res = PyObject_GetAttr(self, _PyIO_str_closed);
if (res == NULL)
PyErr_Clear();
else {
closed = PyObject_IsTrue(res);
Py_DECREF(res);
if (closed == -1)
PyErr_Clear();
}
"""
Furthermore, I'm not sure about what kind of error would make sense here.
----------
Added file: http://bugs.python.org/file23285/buffered_closed_gc-2.diff
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13070>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com