[issue1751] Fast BytesIO implementation + misc changes

Antoine Pitrou report at bugs.python.org
Sun Mar 30 22:29:52 CEST 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Ok I took a detailed look at _bytesio.c.

In write_bytes() there is the following resizing logic:

    if (self->pos + len > self->string_size) {
        if (resize_buffer(self, self->pos + len) < 0)
            return -1;
    }

Replacing `self->string_size` with `self->buf_size` should avoid some
spurious reallocations.

For some reason, using the help() function on a BytesIO instance does
not display the class help.

Overall, the new module looks fine. I can't say anything about the io.py
or _fileio.c fixes.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1751>
__________________________________


More information about the Python-bugs-list mailing list