summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorAriel Eizenberg <ariel.eizenberg@gmail.com>2023-07-06 07:02:22 (GMT)
committerGitHub <noreply@github.com>2023-07-06 07:02:22 (GMT)
commit99b00efd5edfd5b26bf9e2a35cbfc96277fdcbb1 (patch)
tree8971803238cccdeca86b861735a579b47770f664 /Lib/logging
parent38aa89a52ed5194f70bbf07d699a2dd3720e2efd (diff)
downloadcpython-99b00efd5edfd5b26bf9e2a35cbfc96277fdcbb1.zip
cpython-99b00efd5edfd5b26bf9e2a35cbfc96277fdcbb1.tar.gz
cpython-99b00efd5edfd5b26bf9e2a35cbfc96277fdcbb1.tar.bz2
gh-106238: Handle KeyboardInterrupt during logging._acquireLock() (GH-106239)
Co-authored-by: Ariel Eizenberg <ariel.eizenberg@pagaya.com>
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index ba2ed44..fe2039a 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -238,7 +238,11 @@ def _acquireLock():
This should be released with _releaseLock().
"""
if _lock:
- _lock.acquire()
+ try:
+ _lock.acquire()
+ except BaseException:
+ _lock.release()
+ raise
def _releaseLock():
"""