[Python-checkins] r88741 - in python/branches/release27-maint: Lib/test/test_bytes.py Misc/NEWS Objects/bytearrayobject.c

eli.bendersky python-checkins at python.org
Fri Mar 4 07:14:57 CET 2011


Author: eli.bendersky
Date: Fri Mar 4 07:14:56 2011
New Revision: 88741
Log:
Merged revisions 88735 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
 r88735 | eli.bendersky | 2011年03月04日 06:55:25 +0200 (2011年3月04日) | 2 lines
 
 Issue #11386: Fixed the exception thrown by bytearray.pop() for empty bytearrays
........
Modified:
 python/branches/release27-maint/ (props changed)
 python/branches/release27-maint/Lib/test/test_bytes.py
 python/branches/release27-maint/Misc/NEWS
 python/branches/release27-maint/Objects/bytearrayobject.c
Modified: python/branches/release27-maint/Lib/test/test_bytes.py
==============================================================================
--- python/branches/release27-maint/Lib/test/test_bytes.py	(original)
+++ python/branches/release27-maint/Lib/test/test_bytes.py	Fri Mar 4 07:14:56 2011
@@ -695,7 +695,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/release27-maint/Misc/NEWS
==============================================================================
--- python/branches/release27-maint/Misc/NEWS	(original)
+++ python/branches/release27-maint/Misc/NEWS	Fri Mar 4 07:14:56 2011
@@ -34,6 +34,9 @@
 float.__divmod__ with respect to signed zeros. -4.0 % 4.0 should be
 0.0, not -0.0.
 
+- Issue #11386: bytearray.pop() now throws IndexError when the bytearray is
+ empty, instead of OverflowError.
+
 Library
 -------
 
Modified: python/branches/release27-maint/Objects/bytearrayobject.c
==============================================================================
--- python/branches/release27-maint/Objects/bytearrayobject.c	(original)
+++ python/branches/release27-maint/Objects/bytearrayobject.c	Fri Mar 4 07:14:56 2011
@@ -2355,8 +2355,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

AltStyle によって変換されたページ (->オリジナル) /