Date 2015-08-07.10:18:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
From the ctypes.create_string_buffer docs:
"""If a bytes object is specified as first argument, the buffer is made one item larger than its length so that the last element in the array is a NUL termination character. An integer can be passed as second argument which allows to specify the size of the array if the length of the bytes should not be used."""

Based on this documentation I would expect a NUL-terminated byte array in any case. However, when I do this

>>> for size in range(5, 2, -1): print(size, ctypes.create_string_buffer(b'123', size).raw)
5 b'123\x00\x00'
4 b'123\x00'
3 b'123'

I get b'123' for size=3 without a NUL. My expectation would be the same exception as I get for create_string_buffer(b'123', 2).
Date User Action Args
2015-08-07 10:18:08tom.pohlsetrecipients: +
2015-08-07 10:18:08tom.pohlsetmessageid: <>
2015-08-07 10:18:07tom.pohllinkissue24823 messages
2015-08-07 10:18:06tom.pohlcreate