summaryrefslogtreecommitdiff
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2019-08-30 09:25:48 +0500
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2019-08-29 21:25:48 -0700
commit6a650aaf7735e30636db2721247f317064c2cfd4 (patch)
treecab175d9090dacfb5183ac30abf3339e6e3e7489 /Lib/test/test_builtin.py
parent496058f59937da478eb172c864502b5dcf67705b (diff)
downloadcpython-git-6a650aaf7735e30636db2721247f317064c2cfd4.tar.gz
bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592)
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 61155799c4..1100c49e9b 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1477,6 +1477,18 @@ class BuiltinTest(unittest.TestCase):
z1 = zip(a, b)
self.check_iter_pickle(z1, t, proto)
+ def test_zip_bad_iterable(self):
+ exception = TypeError()
+
+ class BadIterable:
+ def __iter__(self):
+ raise exception
+
+ with self.assertRaises(TypeError) as cm:
+ zip(BadIterable())
+
+ self.assertIs(cm.exception, exception)
+
def test_format(self):
# Test the basic machinery of the format() builtin. Don't test
# the specifics of the various formatters