Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit533d60d

Browse files
committed
sys.unraisablehook, not sys.excepthook
1 parentb840a37 commit533d60d

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

‎Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ io
9191
--
9292

9393
The:class:`io.IOBase` finalizer now logs the ``close()`` method errors with
94-
:data:`sys.excepthook`. Previously, errors were ignored silently by default,
94+
:data:`sys.unraisablehook`. Previously, errors were ignored silently by default,
9595
and only logged in:ref:`Python Development Mode<devmode>` or on:ref:`Python
9696
built on debug mode <debug-build>`.
9797
(Contributed by Victor Stinner in:gh:`62948`.)

‎Lib/_pyio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ def __del__(self):
413413
ifclosed:
414414
return
415415

416-
# Calling close() can fail: log an unraisable exception
416+
# If close() fails, the caller logs the exception with
417+
# sys.unraisablehook. close() must be called at the end at __del__().
417418
self.close()
418419

419420
### Inquiries ###
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
The:class:`io.IOBase` finalizer now logs the ``close()`` method errors with
2-
:data:`sys.excepthook`. Previously, errors were ignored silently by default,
2+
:data:`sys.unraisablehook`. Previously, errors were ignored silently by default,
33
and only logged in:ref:`Python Development Mode<devmode>` or on
44
:ref:`Python built on debug mode<debug-build>`. Patch by Victor Stinner.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp