Replace _logger_lock with logging._lock#14584
Merged
jezdez merged 5 commits intoconda:mainfrom Feb 12, 2025
Merged
Conversation
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
dholth
reviewed
Feb 11, 2025
dholth
previously approved these changes
Feb 11, 2025
kenodegard
reviewed
Feb 11, 2025
kenodegard
approved these changes
Feb 11, 2025
CodSpeed Performance ReportMerging #14584 will not alter performanceComparing Summary
|
jezdez
approved these changes
Feb 12, 2025
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
_logger_lock()as a context manager in the common/io module withlogging._lock._logger_lockfunction for deprecation.This use of
logging._lockis supported since Python 3.7.This syntax is supported by Python 3.13. The use of
logging._aquireLockused in the_logger_lockfunction 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 ...
newsdirectory (using the template) for the next release's release notes?