Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1bc4f193
Commit
1bc4f193
authored
Mar 04, 2011
by
Eli Bendersky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #11386: Fixed the exception thrown by bytearray.pop() for empty bytearrays
parent
424298a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
Lib/test/test_bytes.py
Lib/test/test_bytes.py
+1
-1
Misc/NEWS
Misc/NEWS
+3
-0
Objects/bytearrayobject.c
Objects/bytearrayobject.c
+2
-2
No files found.
Lib/test/test_bytes.py
View file @
1bc4f193
...
...
@@ -790,7 +790,7 @@ class ByteArrayTest(BaseBytesTest):
self.assertEqual(b.pop(0), ord('w'))
self.assertEqual(b.pop(-2), ord('r'))
self.assertRaises(IndexError, lambda: b.pop(10))
self.assertRaises(
Overflow
Error, lambda: bytearray().pop())
self.assertRaises(
Index
Error, lambda: bytearray().pop())
# test for issue #6846
self.assertEqual(bytearray(b'
\
xff
').pop(), 0xff)
...
...
Misc/NEWS
View file @
1bc4f193
...
...
@@ -49,6 +49,9 @@ Core and Builtins
- Issue #10516: New copy() and clear() methods for lists and bytearrays.
- Issue #11386: bytearray.pop() now throws IndexError when the bytearray is
empty, instead of OverflowError.
Library
-------
...
...
Objects/bytearrayobject.c
View file @
1bc4f193
...
...
@@ -2309,8 +2309,8 @@ bytearray_pop(PyByteArrayObject *self, PyObject *args)
return
NULL
;
if
(
n
==
0
)
{
PyErr_SetString
(
PyExc_
Overflow
Error
,
"
cannot pop an
empty bytearray"
);
PyErr_SetString
(
PyExc_
Index
Error
,
"
pop from
empty bytearray"
);
return
NULL
;
}
if
(
where
<
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment