summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-03-08 22:49:57 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-03-08 22:49:57 (GMT)
commitc8ab6eeb01ef01d8a630cbf177b06cece326be54 (patch)
tree003792e6304ea92db39f10105fc52b55b727d820 /Lib
parent49d7149e6d12ee878fcf30d703150a5d00f3908d (diff)
downloadcpython-c8ab6eeb01ef01d8a630cbf177b06cece326be54.zip
cpython-c8ab6eeb01ef01d8a630cbf177b06cece326be54.tar.gz
cpython-c8ab6eeb01ef01d8a630cbf177b06cece326be54.tar.bz2
Issue #11444: Lock handlers while flushing/closing during shutdown.
Diffstat (limited to 'Lib')
-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 b555bbe..685efeb 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: