diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-06-05 12:59:41 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-06-05 12:59:41 (GMT) |
commit | e9e397605789b2a67b67558fbbe756b7b88934f5 (patch) | |
tree | 4294134bac41e498ba9f7a889e8b4c8c3791d86a /Modules | |
parent | af1ec97a6d1dde68b2dc0ee9b78965eb219061a8 (diff) | |
download | cpython-e9e397605789b2a67b67558fbbe756b7b88934f5.zip cpython-e9e397605789b2a67b67558fbbe756b7b88934f5.tar.gz cpython-e9e397605789b2a67b67558fbbe756b7b88934f5.tar.bz2 |
bpo-33767: Fix improper use of SystemError by mmap.mmap objects (GH-7381)
Raise TypeError instead of SystemError for unsupported operations.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/mmapmodule.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 9afb79f..27030db 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -812,24 +812,6 @@ mmap_subscript(mmap_object *self, PyObject *item) } } -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) { @@ -949,8 +931,8 @@ mmap_ass_subscript(mmap_object *self, PyObject *item, PyObject *value) 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*/ |