summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-07-17 07:33:14 (GMT)
committerGitHub <noreply@github.com>2018-07-17 07:33:14 (GMT)
commitcc13016658a9ed86d0b702ab6c251ad5952a952f (patch)
treed389d72f407d24c593df34a30a301224a45e35e1 /Lib/test/test_io.py
parent8b5d191386350d28a0f20283dcb366cf50f82b97 (diff)
downloadcpython-cc13016658a9ed86d0b702ab6c251ad5952a952f.zip
cpython-cc13016658a9ed86d0b702ab6c251ad5952a952f.tar.gz
cpython-cc13016658a9ed86d0b702ab6c251ad5952a952f.tar.bz2
bpo-34068: _io__IOBase_close_impl could call _PyObject_SetAttrId with an exception set (GH-8282). (GH-8312)
(cherry picked from commit 28f07364f066792ceee93231dbb80ae8ad98b2bb) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Lib/test/test_io.py')
-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 88fd6ce..f306917 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -957,6 +957,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):