Issue #9501: Fixed logging regressions in cleanup code.

This commit is contained in:
Vinay Sajip 2010-08-23 17:50:30 +00:00
parent 06b8b10090
commit de6e9d615d
2 changed files with 22 additions and 8 deletions

View file

@ -609,6 +609,10 @@ def _removeHandlerRef(wr):
""" """
Remove a handler reference from the internal cleanup list. Remove a handler reference from the internal cleanup list.
""" """
# This function can be called during module teardown, when globals are
# set to None. If _acquireLock is None, assume this is the case and do
# nothing.
if _acquireLock is not None:
_acquireLock() _acquireLock()
try: try:
if wr in _handlerList: if wr in _handlerList:
@ -1604,8 +1608,16 @@ def shutdown(handlerList=_handlerList):
#we just ignore them if raiseExceptions is not set #we just ignore them if raiseExceptions is not set
try: try:
h = wr() h = wr()
if h:
try:
h.flush() h.flush()
h.close() h.close()
except (IOError, ValueError):
# Ignore errors which might be caused
# because handlers have been closed but
# references to them are still around at
# application exit.
pass
except: except:
if raiseExceptions: if raiseExceptions:
raise raise

View file

@ -123,6 +123,8 @@ Extensions
Library Library
------- -------
- Issue #9501: Fixed logging regressions in cleanup code.
- Fix functools.total_ordering() to actually work. - Fix functools.total_ordering() to actually work.
- Issue #9572: Importlib should not raise an exception if a directory it - Issue #9572: Importlib should not raise an exception if a directory it