diff options
| author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-03-08 22:39:55 +0000 |
|---|---|---|
| committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-03-08 22:39:55 +0000 |
| commit | c2b244406c23ccb900680971cd6a00cddf4762e7 (patch) | |
| tree | 257f8d1f0596cf61be97c897200af7ad818b707b | |
| parent | e58cb66c16ad02a7077a02080566cb838391e348 (diff) | |
| download | cpython-c2b244406c23ccb900680971cd6a00cddf4762e7.tar.gz | |
Issue #11444: Lock handlers while flushing/closing during shutdown.
| -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 b48bee85bd..a3b3e391ec 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1513,12 +1513,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: |
