[issue1969] split and rsplit in bytearray are inconsistent
Antoine Pitrou
report at bugs.python.org
Wed Jan 30 00:53:35 CET 2008
New submission from Antoine Pitrou:
In the bytearray type, the split and rsplit methods use a different
definition of what is a whitespace character. split_whitespace calls
ISSPACE(), while rsplit_whitespace calls Py_UNICODE_ISSPACE(). The
latter is probably an error since it is also inconsistent with behaviour
of the bytes type:
>>> s = b"\x09\x0A\x0B\x0C\x0D\x1C\x1D\x1E\x1F"
>>> s.split()
[b'\x1c\x1d\x1e\x1f']
>>> s.rsplit()
[b'\x1c\x1d\x1e\x1f']
>>> b = bytearray(s)
>>> b.split()
[bytearray(b'\x1c\x1d\x1e\x1f')]
>>> b.rsplit()
[]
----------
components: Interpreter Core
messages: 61836
nosy: pitrou
severity: normal
status: open
title: split and rsplit in bytearray are inconsistent
type: behavior
versions: Python 3.0
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1969>
__________________________________
More information about the Python-bugs-list
mailing list