[docs] [issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character
report at bugs.python.org
Mon Jul 25 21:50:15 CEST 2011
Petri Lehtinen <petri at digip.org> added the comment:
> The solution could be global, to allow bytearray fit the 'c' format of
> PyArg_ParseTuple. Then one would also be able to pass a bytearray into
> other stringlib methods requiring the 'c' format.
Another possibility would be the change the 'c' format so that it accepts any object that supports the buffer protocol and whose buffer length is 1.
Attaching two patches: The first allows bytes and bytearray, the second allows any object that supports the buffer protocol.
Added file: http://bugs.python.org/file22756/c_format_bytearray.patch
Python tracker <report at bugs.python.org>
More information about the docs