This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix exception thrown by bytearray.pop() for empty bytearrays
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.3
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: eli.bendersky, georg.brandl, ncoghlan, nnorwitz, rhettinger, terry.reedy
Priority: normal Keywords: easy, needs review, patch

Created on 2011-03-03 18:29 by eli.bendersky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue11386.1.patch eli.bendersky, 2011-03-03 18:32
Messages (9)
msg129989 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-03-03 18:29
bytearray.pop() currently throws OverflowError when popping an empty bytearray, instead of IndexError.

See Issue #10516 for reference discussion.
msg129992 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-03-03 18:32
The attached patch changes the exception thrown to IndexError, as well as aligning the error message to the one thrown by list.
msg129996 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-03-03 18:50
The patch looks fine.  Please apply and backport.

Also, please search all other pop() methods in the standard library to see if this bug occurred anywhere else.  Popping from an empty container should be a LookupError, either IndexError for sequences or KeyError for mappings.
msg130020 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-03-04 04:55
Committed into py3k, revision 88735
msg130021 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-03-04 05:12
Committed into release32-maint, revision 88739
msg130022 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-03-04 05:18
Can't find other instances of this bug, so I'm closing the issue.
msg130023 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-03-04 05:27
Does Python 2.7 have an issue?
msg130027 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-03-04 05:39
Indeed it does - good catch :-)
I'll backport to 2.7 soon
msg130030 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2011-03-04 06:15
Committed to release27-maint, revision 88741
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55595
2011-03-04 06:15:23eli.benderskysetnosy: nnorwitz, georg.brandl, rhettinger, terry.reedy, ncoghlan, eli.bendersky
messages: + msg130030
2011-03-04 05:39:30eli.benderskysetnosy: nnorwitz, georg.brandl, rhettinger, terry.reedy, ncoghlan, eli.bendersky
messages: + msg130027
2011-03-04 05:27:09rhettingersetnosy: nnorwitz, georg.brandl, rhettinger, terry.reedy, ncoghlan, eli.bendersky
messages: + msg130023
2011-03-04 05:18:47eli.benderskysetstatus: open -> closed
nosy: nnorwitz, georg.brandl, rhettinger, terry.reedy, ncoghlan, eli.bendersky
messages: + msg130022
2011-03-04 05:12:57eli.benderskysetnosy: nnorwitz, georg.brandl, rhettinger, terry.reedy, ncoghlan, eli.bendersky
messages: + msg130021
2011-03-04 04:55:48eli.benderskysetversions: - Python 3.2
nosy: nnorwitz, georg.brandl, rhettinger, terry.reedy, ncoghlan, eli.bendersky
messages: + msg130020

assignee: eli.bendersky -> rhettinger
resolution: accepted ->
2011-03-03 18:50:16rhettingersetnosy: + nnorwitz
versions: + Python 3.2
messages: + msg129996

assignee: rhettinger -> eli.bendersky
resolution: accepted
2011-03-03 18:32:25eli.benderskysetfiles: + issue11386.1.patch

messages: + msg129992
keywords: + patch
nosy: georg.brandl, rhettinger, terry.reedy, ncoghlan, eli.bendersky
2011-03-03 18:29:03eli.benderskycreate