Skip to content

Commit 990c249

Browse files
Restore _finalizing to not emit a ResourceWarning when closing the file
1 parent a0a147e commit 990c249

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Lib/test/test_io/test_fileio.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,9 @@ def testFinalizing(self):
520520
with self.assertRaisesRegex(TypeError,
521521
"can't delete numeric/char attribute"):
522522
del self.f._finalizing
523+
# closing a file which is being finalized emits a ResourceWarning
524+
self.f._finalizing = False
525+
523526

524527
class PyAutoFileTests(AutoFileTests, unittest.TestCase):
525528
FileIO = _pyio.FileIO

0 commit comments

Comments
 (0)