conda icon indicating copy to clipboard operation
conda copied to clipboard

Adapt for logging lock internal changes in Python 3.13

Open musicinmybrain opened this issue 1 year ago • 7 comments

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 news directory (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.

musicinmybrain avatar Aug 02 '24 13:08 musicinmybrain

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.

conda-bot avatar Aug 02 '24 13:08 conda-bot

CLA signed…

musicinmybrain avatar Aug 02 '24 13:08 musicinmybrain

@conda-bot check

travishathaway avatar Aug 02 '24 14:08 travishathaway

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

codspeed-hq[bot] avatar Aug 02 '24 15:08 codspeed-hq[bot]

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

jezdez avatar Aug 02 '24 15:08 jezdez

@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.

travishathaway avatar Aug 05 '24 14:08 travishathaway

Thanks for the follow-up. I added a news item.

musicinmybrain avatar Aug 05 '24 14:08 musicinmybrain

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

bdice avatar Feb 02 '25 21:02 bdice

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.

jezdez avatar Feb 04 '25 12:02 jezdez