celery / billiard

Multiprocessing Pool Extensions
Other
419 stars 252 forks source link

Python 3.13: billiard.util.get_logger() is broken #403

Closed musicinmybrain closed 5 months ago

musicinmybrain commented 5 months ago

Since logging._acquireLock is no longer present in Python 3.13, billiard.util.get_logger() no longer works:

$ gh repo clone celery/billiard
$ cd billiard
$ PYTHONPATH="${PWD}" python3.12 -c 'from billiard.util import get_logger; print(get_logger())'
<Logger multiprocessing (WARNING)>
$ PYTHONPATH="${PWD}" python3.13 -c 'from billiard.util import get_logger; print(get_logger())'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from billiard.util import get_logger; print(get_logger())
                                                ~~~~~~~~~~^^
  File "/home/ben/src/forks/billiard/billiard/util.py", line 131, in get_logger
    logging._acquireLock()
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'logging' has no attribute '_acquireLock'
auvipy commented 5 months ago

can you please submit a PR?

musicinmybrain commented 5 months ago

Currently in Python 3.13, the functions _prepareFork and _afterFork correspond closely to the old _acquireLock and _releaseLock. I suppose (as long as billiard is already using non-public APIs) it’s easiest to just call those on Python 3.13.

That approach could perhaps break in the future if these functions start doing something other than acquire/release a module lock, but copying their contents could also break if the internal locking semantics change in a future Python, so :shrug:.

skshetry commented 3 months ago

Hi, is there any plans to release billiard soon? I'm currently working on adding 3.13 support, and would appreciate if this was released.

Nusnus commented 2 months ago

Hi, is there any plans to release billiard soon? I'm currently working on adding 3.13 support, and would appreciate if this was released.

Yes we can do that. Please do add 3.13 and add me for review. After it's done I'll release a new version.

Thank you!

Nusnus commented 2 months ago

Fix released in Billiard v4.2.1