summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-07-17 06:31:44 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-07-17 06:31:44 (GMT)
commit28f07364f066792ceee93231dbb80ae8ad98b2bb (patch)
treed6baa09f3836f1d017b1091fdbf88bb3ff0a5c55 /Lib/test
parent56d8f57b83a37b05a6f2fbc3e141bbc1ba6cb3a2 (diff)
downloadcpython-28f07364f066792ceee93231dbb80ae8ad98b2bb.zip
cpython-28f07364f066792ceee93231dbb80ae8ad98b2bb.tar.gz
cpython-28f07364f066792ceee93231dbb80ae8ad98b2bb.tar.bz2
bpo-34068: _io__IOBase_close_impl could call _PyObject_SetAttrId with an exception set (GH-8282)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_io.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index a03a7f7..c68b2fe 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -968,6 +968,16 @@ class IOTest(unittest.TestCase):
self.assertSequenceEqual(buffer[result:], unused)
self.assertEqual(len(reader.avail), avail - result)
+ def test_close_assert(self):
+ class R(self.IOBase):
+ def __setattr__(self, name, value):
+ pass
+ def flush(self):
+ raise OSError()
+ f = R()
+ # This would cause an assertion failure.
+ self.assertRaises(OSError, f.close)
+
class CIOTest(IOTest):