Issue 27039: bytearray.remove cannot remove bytes with value greater than 127 (original ) (raw )Created on 2016-05-16 16:29 by Damien George , last changed 2022-04-11 14:58 by admin . This issue is now closed .
Messages (8)
msg265709 - (view)
Author: Damien George (Damien George)
Date: 2016-05-16 16:29
The following code fails with a ValueError (but I expect it to succeed): >>> bytearray([128]).remove(128) Tested with Python 2.7.11 and 3.5.1. Probably it's a case of comparing a char (signed byte) with an unsigned value.
msg265711 - (view)
Author: SilentGhost (SilentGhost) *
Date: 2016-05-16 16:41
Test is not catching it, because it only deals with ascii part.
msg265714 - (view)
Author: Joe Jevnik (llllllllll) *
Date: 2016-05-16 17:38
This seems to just be a bug in the implementation of remove. I have a patch to fix this and a test case.
msg265717 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2016-05-16 18:58
LGTM.
msg265719 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2016-05-16 19:02
But we first need to test that value is in the range from 0 to 255.
msg265720 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2016-05-16 19:03
But we first need to test that value is in the range from 0 to 255.
msg265722 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2016-05-16 19:07
Ah, this is already checked in the converter.
msg265726 - (view)
Author: Roundup Robot (python-dev)
Date: 2016-05-16 19:25
New changeset 10444778d41c by Serhiy Storchaka in branch '3.5': Issue #27039 : Fixed bytearray.remove() for values greater than 127. https://hg.python.org/cpython/rev/10444778d41c New changeset 9acf44b7ff7b by Serhiy Storchaka in branch '2.7': Issue #27039 : Fixed bytearray.remove() for values greater than 127. https://hg.python.org/cpython/rev/9acf44b7ff7b New changeset 3eb502d43616 by Serhiy Storchaka in branch 'default': Issue #27039 : Fixed bytearray.remove() for values greater than 127. https://hg.python.org/cpython/rev/3eb502d43616
History
Date
User
Action
Args
2022-04-11 14:58:31
admin
set
github: 71226
2016-05-16 19:25:52
serhiy.storchaka
set
status: open -> closedresolution: fixedstage: commit review -> resolved
2016-05-16 19:25:07
python-dev
set
nosy: + python-dev messages: +
2016-05-16 19:07:35
serhiy.storchaka
set
messages: +
2016-05-16 19:03:01
serhiy.storchaka
set
messages: +
2016-05-16 19:02:57
serhiy.storchaka
set
messages: +
2016-05-16 18:58:43
serhiy.storchaka
set
assignee: serhiy.storchaka messages: + stage: commit review
2016-05-16 17:38:20
llllllllll
set
files: + bytearray-remove.patch nosy: + llllllllll messages: + keywords: + patch
2016-05-16 16:41:58
SilentGhost
set
nosy: + SilentGhost messages: +
2016-05-16 16:39:45
SilentGhost
set
nosy: + serhiy.storchaka versions: + Python 3.6
2016-05-16 16:29:48
Damien George
create