summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-03-08 22:39:55 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-03-08 22:39:55 (GMT)
commitf4d0af460a279859b75c11500f14d14a1b29ee79 (patch)
tree7f092fec46b3bea1efe5f249f35dd74501dc9ca8 /Lib/logging
parent8dd2a40bc7feb3b3c2213ed9b7ea7a5bd58ff101 (diff)
downloadcpython-f4d0af460a279859b75c11500f14d14a1b29ee79.zip
cpython-f4d0af460a279859b75c11500f14d14a1b29ee79.tar.gz
cpython-f4d0af460a279859b75c11500f14d14a1b29ee79.tar.bz2
Issue #11444: Lock handlers while flushing/closing during shutdown.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index b48bee8..a3b3e39 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: