gh-106238: Handle KeyboardInterrupt during logging._acquireLock() (GH-106239)

Co-authored-by: Ariel Eizenberg <ariel.eizenberg@pagaya.com>
This commit is contained in:
Ariel Eizenberg 2023-07-06 10:02:22 +03:00 committed by GitHub
parent 38aa89a52e
commit 99b00efd5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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():
"""

View File

@ -0,0 +1 @@
Fix rare concurrency bug in lock acquisition by the logging package.