mirror of
https://github.com/python/cpython.git
synced 2025-12-09 10:37:17 +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.
|
Should be called at application exit.
|
||||||
"""
|
"""
|
||||||
for h in _handlers.keys():
|
for h in _handlers.keys():
|
||||||
h.flush()
|
#errors might occur, for example, if files are locked
|
||||||
h.close()
|
#we just ignore them
|
||||||
|
try:
|
||||||
|
h.flush()
|
||||||
|
h.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
#Let's try and shutdown automatically on application exit...
|
#Let's try and shutdown automatically on application exit...
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue