[2.7] bpo-33767: Fix improper use of SystemError by mmap.mmap objects (GH-7381) (GH-7432)
Raise TypeError instead of SystemError for unsupported operations.
(cherry picked from commit e9e397605789b2a67b67558fbbe756b7b88934f5)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 0350b3d..fc6d6e1 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -666,6 +666,13 @@
self.assertRaises(ValueError, m.write_byte, 'b')
self.assertRaises(ValueError, m.write, '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):