self.assertRaises(ValueError, m.write_byte, 42)
self.assertRaises(ValueError, m.write, b'abc')
+ def test_concat_repeat_exception(self):
+ m = mmap.mmap(-1, 16)
+ with self.assertRaises(TypeError):
+ m + m
+ with self.assertRaises(TypeError):
+ m * 2
+
class LargeMmapTests(unittest.TestCase):
}
}
-static PyObject *
-mmap_concat(mmap_object *self, PyObject *bb)
-{
- CHECK_VALID(NULL);
- PyErr_SetString(PyExc_SystemError,
- "mmaps don't support concatenation");
- return NULL;
-}
-
-static PyObject *
-mmap_repeat(mmap_object *self, Py_ssize_t n)
-{
- CHECK_VALID(NULL);
- PyErr_SetString(PyExc_SystemError,
- "mmaps don't support repeat operation");
- return NULL;
-}
-
static int
mmap_ass_item(mmap_object *self, Py_ssize_t i, PyObject *v)
{
static PySequenceMethods mmap_as_sequence = {
(lenfunc)mmap_length, /*sq_length*/
- (binaryfunc)mmap_concat, /*sq_concat*/
- (ssizeargfunc)mmap_repeat, /*sq_repeat*/
+ 0, /*sq_concat*/
+ 0, /*sq_repeat*/
(ssizeargfunc)mmap_item, /*sq_item*/
0, /*sq_slice*/
(ssizeobjargproc)mmap_ass_item, /*sq_ass_item*/