diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-03-08 22:49:57 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-03-08 22:49:57 +0000 |
commit | 75964020ca2e3ab0fec80df923cf30cc0c12670d (patch) | |
tree | 723b3a34c2fa9f3de62b8f11c3908da34a56c7f2 /Lib/logging | |
parent | d232eff89a9a92c5a51656698ffeafc586996137 (diff) | |
download | cpython-75964020ca2e3ab0fec80df923cf30cc0c12670d.tar.gz |
Issue #11444: Lock handlers while flushing/closing during shutdown.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/__init__.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index b555bbefd3..685efeb4a8 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1507,12 +1507,15 @@ def shutdown(handlerList=_handlerList): #errors might occur, for example, if files are locked #we just ignore them if raiseExceptions is not set try: + h.acquire() h.flush() h.close() except: if raiseExceptions: raise #else, swallow + finally: + h.release() #Let's try and shutdown automatically on application exit... try: |