Skip to content

Commit

Permalink
Adapt for logging lock internal changes in Python3.13
Browse files Browse the repository at this point in the history
Fixes celery#403.
  • Loading branch information
musicinmybrain authored and auvipy committed Jun 15, 2024
1 parent 8bffa2c commit 81cc942
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions billiard/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -145,7 +150,7 @@ def get_logger():
atexit._exithandlers.remove((_exit_function, (), {}))
atexit._exithandlers.append((_exit_function, (), {}))
finally:
logging._releaseLock()
release()

return _logger

Expand Down

0 comments on commit 81cc942

Please sign in to comment.