Repository navigation
Conversation
with_level saved the effective level as the previous value, so the ensure clause wrote it back as an override and left the entry for the calling fiber in place. After the block, level= had no effect on that fiber, and the fiber could not be garbage collected while the logger was alive. Co-authored-by: Claude Mythos 5.2 <noreply@anthropic.com>
Author
|
Closing in favor of #169. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #135.
Logger#with_levelsaves the previous level by callinglevel, which falls back to@levelwhen the current fiber has no override. Theensureclause then writes that value back as an override, and the entry for the calling fiber stays in@level_override:The leftover entry also keeps the fiber from being garbage collected while the logger is alive. A finished thread's root fiber is retained the same way, which is the leak reported in #135.
with_levelnow saveslevel_override[level_key]as the previous value, so the outermost call deletes its entry and a nested call restores the enclosing override.