summaryrefslogtreecommitdiff
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-03-08 22:49:57 +0000
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-03-08 22:49:57 +0000
commit75964020ca2e3ab0fec80df923cf30cc0c12670d (patch)
tree723b3a34c2fa9f3de62b8f11c3908da34a56c7f2 /Lib/logging
parentd232eff89a9a92c5a51656698ffeafc586996137 (diff)
downloadcpython-75964020ca2e3ab0fec80df923cf30cc0c12670d.tar.gz
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 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: