From cbc1042c2803a2e152a85a45c1a41b8449166696 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 15 Jun 2024 11:11:27 -0400 Subject: [PATCH] Adapt for logging lock internal changes in Python3.13 Fixes #403. --- billiard/util.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/billiard/util.py b/billiard/util.py index 0fdf2a2..751959d 100644 --- a/billiard/util.py +++ b/billiard/util.py @@ -128,7 +128,12 @@ def get_logger(): global _logger import logging - logging._acquireLock() + try: + # Python 3.13+ + acquire, release = logging._prepareFork, logging._afterFork + except AttributeError: + acquire, release = logging._acquireLock, logging._releaseLock + acquire() try: if not _logger: @@ -145,7 +150,7 @@ def get_logger(): atexit._exithandlers.remove((_exit_function, (), {})) atexit._exithandlers.append((_exit_function, (), {})) finally: - logging._releaseLock() + release() return _logger