Repository navigation
Avoid mutating caller-owned path segments during load and add - #204
Open
rupayon123 wants to merge 1 commit into
Open
rupayon123 wants to merge 1 commit into
rupayon123 wants to merge 1 commit into
Conversation
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.
Copy caller-owned path segments before loading or adding them. Previously,
Path(['', 'a'])removed the caller's leading segment, constructing from another Path shared its mutable segment list, andPath('/').add(source_path)could change the source from/ainto//a. The destination now owns its segment container.Four regression tests fail before the fix and pass afterward. The full Python3.11.15 nose2 run contains81 tests with the same one failure and two errors as unchanged master's77-test run (
test_odd_urls,test_hosts,test_netloc). Flake8 passes for the changed source and tests; diff whitespace checks pass.This addresses aliasing only; the separate absoluteness issue in #202 is not duplicated. Tests do not claim that constructing from an absolute Path already preserves its absoluteness.
AI-assisted with OpenAI Codex for rupayon123. Found by source inspection and reproduced with both caller lists and Path objects. No production-usage claim.