Skip to content

Adapt for logging lock internal changes in Python 3.13#14117

Closed
musicinmybrain wants to merge 4 commits intoconda:python-3.13from
musicinmybrain:logging-lock-python3.13
Closed

Adapt for logging lock internal changes in Python 3.13#14117
musicinmybrain wants to merge 4 commits intoconda:python-3.13from
musicinmybrain:logging-lock-python3.13

Conversation

@musicinmybrain
Copy link
Copy Markdown

@musicinmybrain musicinmybrain commented Aug 2, 2024

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

(See also celery/billiard#404.)

Checklist - did you ...

  • 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.
  • Add / update necessary tests? Covered by existing tests, when executed on Python 3.13
  • Add / update outdated documentation? Nothing to do.

Fixes: #14439

@conda-bot
Copy link
Copy Markdown
Contributor

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 (conda/infrastructure#977), and ping the bot to refresh the PR.

@musicinmybrain
Copy link
Copy Markdown
Author

CLA signed…

@travishathaway
Copy link
Copy Markdown
Contributor

@conda-bot check

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Aug 2, 2024
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Aug 2, 2024

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

@jezdez
Copy link
Copy Markdown
Member

jezdez commented Aug 2, 2024

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

@travishathaway
Copy link
Copy Markdown
Contributor

travishathaway commented Aug 5, 2024

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

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.

@musicinmybrain
Copy link
Copy Markdown
Author

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

@bdice
Copy link
Copy Markdown

bdice commented Feb 2, 2025

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: conda-forge/conda-feedstock#246 (comment)

Copy link
Copy Markdown
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Ben! 🙏

FWIW LGTM

In terms of Python 3.13 CI, filed a separate issue to track adding that: #14554

Comment thread news/14117-logging-lock-changes Outdated
@jezdez jezdez changed the base branch from main to python-3.13 February 4, 2025 12:04
@jezdez jezdez requested a review from a team as a code owner February 4, 2025 12:04
@jezdez
Copy link
Copy Markdown
Member

jezdez commented Feb 4, 2025

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.

@github-actions github-actions Bot added the locked [bot] locked due to inactivity label Feb 13, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

"AttributeError: module 'logging' has no attribute '_acquireLock'" w/ Python 3.13

6 participants