[New-bugs-announce] [issue20047] bytearray partition bug

Mark Lawrence report at bugs.python.org
Sat Dec 21 20:52:41 CET 2013


New submission from Mark Lawrence:

If partition is called with a single byte it works correctly but if called with the equivalent integer it returns the same bytearray with two empty arrays as follows.

py> ba = bytearray(range(8))
py> ba
bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07')
py> 3 in ba
True
py> ba.find(3) == ba.index(3) == ba.find(b'\x03')
True
py> ba.partition(b'\x03')
(bytearray(b'\x00\x01\x02'), bytearray(b'\x03'), bytearray(b'\x04\x05\x06
\x07'))
py> ba.partition(3)
(bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07'), bytearray(b''), bytearray
(b''))

More background on the thread starting here https://mail.python.org/pipermail/python-list/2013-December/663111.html which refers to Issue 12170.

----------
components: Interpreter Core
messages: 206773
nosy: BreamoreBoy
priority: normal
severity: normal
status: open
title: bytearray partition bug
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20047>
_______________________________________


More information about the New-bugs-announce mailing list