Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Le vendredi 01 août 2008 à 17:53 +0000, Amaury Forgeot d'Arc a écrit : > There is a small issue with the patch: in the "w#" format handler, > bf_getwritebuffer(arg, 0, res) is wrong. The third argument should be > &res (there is a compilation warning on windows), > > And a few lines after, in the "if (*format == '#')" block, there should > be a line like > *p = res; > otherwise the user code never sees the buffer...
Nice catch! Making those changes actually fixes a segfault I had in testReadinto in test_file.py. By the way, please note bytearray.decode is broken: Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: ascii_decode() argument 1 must be string or pinned buffer, not bytearray >>> bytearray(b"").decode("utf8") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/antoine/cpython/bufferedwriter/Lib/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) TypeError: utf_8_decode() argument 1 must be string or pinned buffer, not bytearray >>> bytearray(b"").decode("latin1") Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: latin_1_decode() argument 1 must be string or pinned buffer, not bytearray _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3139> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com