]> granicus.if.org Git - python/commitdiff
bpo-37223, test_io: silence last 'Exception ignored in:' (GH-14029)
authorVictor Stinner <vstinner@redhat.com>
Wed, 12 Jun 2019 21:57:11 +0000 (23:57 +0200)
committerGitHub <noreply@github.com>
Wed, 12 Jun 2019 21:57:11 +0000 (23:57 +0200)
Use catch_unraisable_exception() to ignore 'Exception ignored in:'
error when the internal BufferedWriter of the BufferedRWPair is
destroyed. The C implementation doesn't give access to the
internal BufferedWriter, so just ignore the warning instead.

Lib/test/test_io.py

index 102679b1d3424359a292f686cfbe5943249d7378..55686d743983556a48e3fe29abe301a6bd06d0d8 100644 (file)
@@ -2070,6 +2070,11 @@ class BufferedRWPairTest(unittest.TestCase):
 
         # Silence destructor error
         writer.close = lambda: None
+        writer = None
+
+        with support.catch_unraisable_exception():
+            pair = None
+            support.gc_collect()
 
     def test_reader_writer_close_error_on_close(self):
         def reader_close():