From bc2aa816620c5e02ad8e94d8514b7e8f3f551ca1 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 23 May 2019 03:45:09 +0200 Subject: bpo-18748: _pyio.IOBase emits unraisable exception (GH-13512) In development (-X dev) mode and in a debug build, IOBase finalizer of the _pyio module now logs the exception if the close() method fails. The exception is ignored silently by default in release build. test_io: test_error_through_destructor() now uses support.catch_unraisable_exception() rather than capturing stderr. --- Doc/whatsnew/3.8.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Doc/whatsnew') diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 8c2b40de11..b91f7bca63 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -318,6 +318,15 @@ for :func:`property`, :func:`classmethod`, and :func:`staticmethod`:: self.bit_rate = round(bit_rate / 1000.0, 1) self.duration = ceil(duration) +io +-- + +In development mode (:option:`-X` ``env``) and in debug build, the +:class:`io.IOBase` finalizer now logs the exception if the ``close()`` method +fails. The exception is ignored silently by default in release build. +(Contributed by Victor Stinner in :issue:`18748`.) + + gc -- -- cgit v1.2.1