Santoso Wijaya <santoso.wij...@gmail.com> added the comment: As for the "<memory at %p>" string, when _io.BufferedWriter prepares the byte buffer into a PyMemoryView wrapper and passes it into the raw IO object:
res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_write, memobj, NULL); For some reason, memobj.__repr__ is called before being passed to the raw IO's write method. I can't reproduce this odd behavior using a dumb raw IO that extends _io.RawIOBase. Mimicking what pyserial does, however, reproduces both issues (see attached). ---------- Added file: http://bugs.python.org/file22379/test_bufio.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12340> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com