mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-34068: _io__IOBase_close_impl could call _PyObject_SetAttrId with an exception set (GH-8282)
This commit is contained in:
parent
56d8f57b83
commit
28f07364f0
3 changed files with 20 additions and 5 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue