New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix exception thrown by bytearray.pop() for empty bytearrays #55595
Comments
bytearray.pop() currently throws OverflowError when popping an empty bytearray, instead of IndexError. See Issue bpo-10516 for reference discussion. |
The attached patch changes the exception thrown to IndexError, as well as aligning the error message to the one thrown by list. |
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. |
Committed into py3k, revision 88735 |
Committed into release32-maint, revision 88739 |
Can't find other instances of this bug, so I'm closing the issue. |
Does Python 2.7 have an issue? |
Indeed it does - good catch :-) |
Committed to release27-maint, revision 88741 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: