[issue37223] test_io logs Exception ignored in: <function IOBase.__del__ at 0x7f2f3c73e4b0> warnings
STINNER Victor
report at bugs.python.org
Mon Jun 10 20:18:18 EDT 2019
STINNER Victor <vstinner at redhat.com> added the comment:
PR 13952 fix many errors, but not of all them.
test_io.PyBufferedWriterTest.test_misbehaved_io() logs a warning, whereas test_io.CBufferedWriterTest.test_misbehaved_io() doesn't. It seems like _pyio.BufferedWriter lacks bpo-32228 fix.
Extract of the C implementation:
static PyObject *
_bufferedwriter_flush_unlocked(buffered *self)
{
...
if (!VALID_WRITE_BUFFER(self) || self->write_pos == self->write_end)
goto end;
/* First, rewind */
rewind = RAW_OFFSET(self) + (self->pos - self->write_pos);
if (rewind != 0) {
n = _buffered_raw_seek(self, -rewind, 1);
if (n < 0) {
goto error;
}
self->raw_pos -= rewind;
}
...
end:
/* This ensures that after return from this function,
VALID_WRITE_BUFFER(self) returns false.
This is a required condition because when a tell() is called
after flushing and if VALID_READ_BUFFER(self) is false, we need
VALID_WRITE_BUFFER(self) to be false to have
RAW_OFFSET(self) == 0.
Issue: https://bugs.python.org/issue32228 */
_bufferedwriter_reset_buf(self);
Py_RETURN_NONE;
error:
return NULL;
}
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37223>
_______________________________________
More information about the Python-bugs-list
mailing list