fix: weaken re-keyed child refs in rename for both mock hashes - #419
Draft
toddr-bot wants to merge 1 commit into
Draft
fix: weaken re-keyed child refs in rename for both mock hashes#419toddr-bot wants to merge 1 commit into
toddr-bot wants to merge 1 commit into
Conversation
Directory rename re-keys child entries in %files_being_mocked and %_autovivify_dirs but stored them as strong references, preventing garbage collection when the mock variable goes out of scope. Add Scalar::Util::weaken() after both re-keying assignments in the __rename child loop, matching every other insertion point into these hashes. Supersedes PR cpan-authors#417 which only covered %files_being_mocked.
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.
What
Weaken re-keyed child refs in
__renamefor both%files_being_mockedand%_autovivify_dirs.Why
Directory rename re-keys child entries in these two hashes but stored them as strong references — the only insertion points across the codebase that skipped
weaken(). This prevents garbage collection: child mocks surviveundefafter their parent is renamed.Extends PR #417 (which covered only
%files_being_mocked) to also fix%_autovivify_dirs. Supersedes #417. Closes #418.How
Two
Scalar::Util::weaken()calls added to the child re-keying loop in__rename, matching the pattern at every other insertion point.Testing
Quality Report
Changes: 2 files changed, 33 insertions(+)
Code scan: clean
Tests: failed (4 Failed, 94 test)
Branch hygiene: clean
Generated by Kōan