Skip to content

Replace _logger_lock with logging._lock#14584

Merged
jezdez merged 5 commits intoconda:mainfrom
jjhelmus:rm_logger_lock
Feb 12, 2025
Merged

Replace _logger_lock with logging._lock#14584
jezdez merged 5 commits intoconda:mainfrom
jjhelmus:rm_logger_lock

Conversation

@jjhelmus
Copy link
Copy Markdown
Contributor

@jjhelmus jjhelmus commented Feb 11, 2025

Description

  • Replace use of _logger_lock() as a context manager in the common/io module with logging._lock.
  • Mark the _logger_lock function for deprecation.

This use of logging._lock is supported since Python 3.7.

This syntax is supported by Python 3.13. The use of logging._aquireLock used in the _logger_lock function is problematic as the function was removed in Python 3.13 (python/cpython#109462)

This is inspired by a similar change in pastescript, pasteorg/pastescript#15

This would make #14117 unnecessary unless an update to the function marked for deprecation is needed.

Closes #14117 and #14439.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

Aquire the logging lock using the underlying _lock object from the
logging module.

As of python/cpython#3385, included in Python 3.7, this object an instance
of threading.RLock whose use as a context manager with release being
called when the block exits, see
https://docs.python.org/3/library/threading.html#using-locks-conditions-and-semaphores-in-the-with-statement
@jjhelmus jjhelmus requested a review from a team as a code owner February 11, 2025 20:22
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Feb 11, 2025
Comment thread news/14584-use-logging-lock Outdated
dholth
dholth previously approved these changes Feb 11, 2025
Comment thread conda/common/io.py Outdated
Comment thread news/14584-use-logging-lock Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 11, 2025

CodSpeed Performance Report

Merging #14584 will not alter performance

Comparing jjhelmus:rm_logger_lock (c67658f) with main (48ec6d4)

Summary

✅ 21 untouched benchmarks

@jezdez jezdez merged commit d108fc5 into conda:main Feb 12, 2025
@kenodegard kenodegard mentioned this pull request Mar 17, 2025
81 tasks
@github-actions github-actions Bot added the locked [bot] locked due to inactivity label Feb 14, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 14, 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.

5 participants