Adapt for logging lock internal changes in Python 3.13
Description
In Fedora Rawhide (the development version), the system Python is now 3.13.0rc1. We are therefore testing conda (and everything else) on Python 3.13 regardless of whether “official” support is ready or not.
This PR fixes errors like:
+ conda info
Traceback (most recent call last):
[…]
File "/builddir/build/BUILD/conda-24.7.1-build/BUILDROOT/usr/lib/python3.13/site-packages/conda/common/io.py", line 272, in _logger_lock
logging._acquireLock()
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'logging' has no attribute '_acquireLock'
Currently in Python 3.13, the logging functions _prepareFork and _afterFork correspond closely to the old _acquireLock and _releaseLock, which have been removed.
As long as conda 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:.
(See also https://github.com/celery/billiard/pull/404.)
Checklist - did you ...
- [x] Add a file to the
newsdirectory (using the template) for the next release's release notes? ~~I didn’t consider this “significant” enough for an entry, but let me know if I need to add one.~~ - [x] Add / update necessary tests? Covered by existing tests, when executed on Python 3.13
- [x] Add / update outdated documentation? Nothing to do.
We require contributors to sign our Contributor License Agreement and we don't have one on file for @musicinmybrain.
In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature, merge the PR (https://github.com/conda/infrastructure/pull/977), and ping the bot to refresh the PR.
CLA signed…
@conda-bot check
CodSpeed Performance Report
Merging #14117 will not alter performance
Comparing musicinmybrain:logging-lock-python3.13 (6c4c68d) with python-3.13 (bf22d1b)
Summary
✅ 21 untouched benchmarks
We don't currently run the tests on Python 3.13, so it's a little hard to see if this has a negative impact on runtime behavior etc
@musicinmybrain,
Can you please add a news file for this pull request. You just need to put a bullet point under "Other". We recently had to add a change for xonsh regarding a deprecated import path, so that would be a good example to look at:
- https://github.com/conda/conda/blob/main/news/14047-update-xonsh-support
Please use the pull request number in the title and at the end of the line of the bullet point.
Also, as @jezdez said, once we have the ability to test Python 3.13 (i.e. this has been deployed to channels like defaults and conda-forge) we will be begin testing it. Provided everything is working and not causing negative impacts, we will merge it then.
Thanks for the follow-up. I added a news item.
Hi, what is the next step for this fix? I just ran into this while attempting to help conda-forge with the Python 3.13 migration for the conda package. This does fix the problems I encountered. Could this be reviewed/merged?
xref: https://github.com/conda-forge/conda-feedstock/issues/246#issuecomment-2629559879
I've changed the base branch here since we'll want to actually test this on Python 3.13 as well. See #14554 for progress on the larger work to add support for all dependencies etc.