[Python-checkins] r88735 - in python/branches/py3k: Lib/test/test_bytes.py Misc/NEWS Objects/bytearrayobject.c
eli.bendersky
python-checkins at python.org
Fri Mar 4 05:55:25 CET 2011
Author: eli.bendersky
Date: Fri Mar 4 05:55:25 2011
New Revision: 88735
Log:
Issue #11386: Fixed the exception thrown by bytearray.pop() for empty bytearrays
Modified:
python/branches/py3k/Lib/test/test_bytes.py
python/branches/py3k/Misc/NEWS
python/branches/py3k/Objects/bytearrayobject.c
Modified: python/branches/py3k/Lib/test/test_bytes.py
==============================================================================
--- python/branches/py3k/Lib/test/test_bytes.py (original)
+++ python/branches/py3k/Lib/test/test_bytes.py Fri Mar 4 05:55:25 2011
@@ -790,7 +790,7 @@
self.assertEqual(b.pop(0), ord('w'))
self.assertEqual(b.pop(-2), ord('r'))
self.assertRaises(IndexError, lambda: b.pop(10))
- self.assertRaises(OverflowError, lambda: bytearray().pop())
+ self.assertRaises(IndexError, lambda: bytearray().pop())
# test for issue #6846
self.assertEqual(bytearray(b'\xff').pop(), 0xff)
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Fri Mar 4 05:55:25 2011
@@ -49,6 +49,9 @@
- 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
-------
Modified: python/branches/py3k/Objects/bytearrayobject.c
==============================================================================
--- python/branches/py3k/Objects/bytearrayobject.c (original)
+++ python/branches/py3k/Objects/bytearrayobject.c Fri Mar 4 05:55:25 2011
@@ -2309,8 +2309,8 @@
return NULL;
if (n == 0) {
- PyErr_SetString(PyExc_OverflowError,
- "cannot pop an empty bytearray");
+ PyErr_SetString(PyExc_IndexError,
+ "pop from empty bytearray");
return NULL;
}
if (where < 0)
More information about the Python-checkins
mailing list