bpo-37417: Fix error handling in bytearray.extend. (GH-14407)
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index b536cec..6115579 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1592,6 +1592,11 @@
self.assertRaises(ValueError, x.translate, b"1", 1)
self.assertRaises(TypeError, x.translate, b"1"*256, 1)
+ def test_bytearray_extend_error(self):
+ array = bytearray()
+ bad_iter = map(int, "X")
+ self.assertRaises(ValueError, array.extend, bad_iter)
+
def test_construct_singletons(self):
for const in None, Ellipsis, NotImplemented:
tp = type(const)