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

Commitb840a37

Browse files
committed
Update _pyio
1 parent5d51cc9 commitb840a37

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

‎Lib/_pyio.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@
3333
# Rebind for compatibility
3434
BlockingIOError=BlockingIOError
3535

36-
# Does io.IOBase finalizer log the exception if the close() method fails?
37-
# The exception is ignored silently by default in release build.
38-
_IOBASE_EMITS_UNRAISABLE= (hasattr(sys,"gettotalrefcount")orsys.flags.dev_mode)
3936
# Does open() check its 'errors' argument?
40-
_CHECK_ERRORS=_IOBASE_EMITS_UNRAISABLE
37+
_CHECK_ERRORS=(hasattr(sys,"gettotalrefcount")orsys.flags.dev_mode)
4138

4239

4340
deftext_encoding(encoding,stacklevel=2):
@@ -416,18 +413,8 @@ def __del__(self):
416413
ifclosed:
417414
return
418415

419-
if_IOBASE_EMITS_UNRAISABLE:
420-
self.close()
421-
else:
422-
# The try/except block is in case this is called at program
423-
# exit time, when it's possible that globals have already been
424-
# deleted, and then the close() call might fail. Since
425-
# there's nothing we can do about such failures and they annoy
426-
# the end users, we suppress the traceback.
427-
try:
428-
self.close()
429-
except:
430-
pass
416+
# Calling close() can fail: log an unraisable exception
417+
self.close()
431418

432419
### Inquiries ###
433420

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp