Author pitrou
Recipients amaury.forgeotdarc, barry, benjamin.peterson, donmez, giampaolo.rodola, gpolo, loewis, pitrou, teoliphant
Date 2008-08-01.18:48:27
SpamBayes Score 2.13103e-08
Marked as misclassified No
Message-id <1217616501.5918.4.camel@fsol>
In-reply-to <1217613229.32.0.270035641585.issue3139@psf.upfronthosting.co.za>
Content
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
History
Date User Action Args
2008-08-01 18:48:28pitrousetrecipients: + pitrou, loewis, barry, teoliphant, amaury.forgeotdarc, giampaolo.rodola, donmez, benjamin.peterson, gpolo
2008-08-01 18:48:27pitroulinkissue3139 messages
2008-08-01 18:48:27pitroucreate