8000 bpo-37223, test_io: silence last 'Exception ignored in:' (GH-14029) · python/cpython@913fa1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 913fa1c

Browse files
authored
bpo-37223, test_io: silence last 'Exception ignored in:' (GH-14029)
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.
1 parent 0d19427 commit 913fa1c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_io.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,6 +2070,11 @@ def writer_close():
20702070

20712071
# Silence destructor error
20722072
writer.close = lambda: None
2073+
writer = None
2074+
2075+
with support.catch_unraisable_exception():
2076+
pair = None
2077+
support.gc_collect()
20732078

20742079
def test_reader_writer_close_error_on_close(self):
20752080
def reader_close():

0 commit comments

Comments
 (0)
0