Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r1018:15e763a4ae27
Date: 2012-10-29 09:29 +0100
http://bitbucket.org/cffi/cffi/changeset/15e763a4ae27/

Log:    Giving a TypeError doesn't make much sense here, even though
        CPython's buffer type does it.

diff --git a/c/minibuffer.h b/c/minibuffer.h
--- a/c/minibuffer.h
+++ b/c/minibuffer.h
@@ -70,7 +70,7 @@
 
     count = right - left;
     if (count != buffer_len) {
-        PyErr_SetString(PyExc_TypeError,
+        PyErr_SetString(PyExc_ValueError,
                         "right operand length must match slice length");
         return -1;
     }
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -1861,8 +1861,8 @@
     # --mb_ass_slice--
     buf[:] = b"hi there\x00"
     assert list(buf) == list(c) == list(b"hi there\x00")
-    py.test.raises(TypeError, 'buf[:] = b"shorter"')
-    py.test.raises(TypeError, 'buf[:] = b"this is much too long!"')
+    py.test.raises(ValueError, 'buf[:] = b"shorter"')
+    py.test.raises(ValueError, 'buf[:] = b"this is much too long!"')
     buf[4:2] = b""   # no effect, but should work
     assert buf[:] == b"hi there\x00"
     expected = list(b"hi there\x00")
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to