Martin Panter added the comment: I discovered a flaw in the bytearray tests: most of them don’t actually test bytearray objects! This is easy to fix in Python 3, and I added a test case to ensure that the arguments are converted to the expected type.
However porting this fix to Python 2 was trickier. A few of the bytearray methods do not accept bytearray arguments: >>> bytearray(b"abc").ljust(10, bytearray(b"*")) TypeError: ljust() argument 2 must be char, not bytearray >>> bytearray(b"abc").rjust(10, bytearray(b"*")) TypeError: rjust() argument 2 must be char, not bytearray >>> bytearray(b"abc").center(10, bytearray(b"*")) TypeError: center() argument 2 must be char, not bytearray I adapted the tests from the deleted buffer_tests.py file to override the relevant tests from string_tests.py, so that we continue to test bytearray methods but with str a.k.a. bytes arguments. ---------- versions: +Python 2.7 Added file: http://bugs.python.org/file42377/buffer_tests.py2.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26257> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com