mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Ignore exceptions which occur when closing files in shutdown()
This commit is contained in:
parent
f9fd0d7988
commit
e12f71586a
1 changed files with 7 additions and 2 deletions
|
|
@ -1256,8 +1256,13 @@ def shutdown():
|
|||
Should be called at application exit.
|
||||
"""
|
||||
for h in _handlers.keys():
|
||||
h.flush()
|
||||
h.close()
|
||||
#errors might occur, for example, if files are locked
|
||||
#we just ignore them
|
||||
try:
|
||||
h.flush()
|
||||
h.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
#Let's try and shutdown automatically on application exit...
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue