[pypy-commit] pypy merge-2.7.2: Change to the new exception for bytearray().pop()

alex_gaynor noreply at buildbot.pypy.org
Sun Jan 22 19:16:41 CET 2012


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: merge-2.7.2
Changeset: r51650:f17c2e5a8629
Date: 2012-01-22 12:16 -0600
http://bitbucket.org/pypy/pypy/changeset/f17c2e5a8629/

Log:	Change to the new exception for bytearray().pop()

diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -414,8 +414,8 @@
         result = w_bytearray.data.pop(index)
     except IndexError:
         if not w_bytearray.data:
-            raise OperationError(space.w_OverflowError, space.wrap(
-                "cannot pop an empty bytearray"))
+            raise OperationError(space.w_IndexError, space.wrap(
+                "pop from empty bytearray"))
         raise OperationError(space.w_IndexError, space.wrap(
             "pop index out of range"))
     return space.wrap(ord(result))
diff --git a/pypy/objspace/std/test/test_bytearrayobject.py b/pypy/objspace/std/test/test_bytearrayobject.py
--- a/pypy/objspace/std/test/test_bytearrayobject.py
+++ b/pypy/objspace/std/test/test_bytearrayobject.py
@@ -266,7 +266,7 @@
         assert b.pop(0) == ord('w')
         assert b.pop(-2) == ord('r')
         raises(IndexError, b.pop, 10)
-        raises(OverflowError, bytearray().pop)
+        raises(IndexError, bytearray().pop)
         assert bytearray('\xff').pop() == 0xff
 
     def test_remove(self):


More information about the pypy-commit mailing list