Skip to content

fix: isolate selector trees when copying maps - #223

Open
Shubham-Padkonde wants to merge 1 commit into
google:masterfrom
Shubham-Padkonde:fix/independent-selector-copy
Open

Shubham-Padkonde wants to merge 1 commit into
google:masterfrom
Shubham-Padkonde:fix/independent-selector-copy

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Copying a SelectorMap currently shares the nested selector tree while copying its value dictionary. Adding two.name to a copy containing one.name makes the original's get_all_matches('name') raise KeyError; removing an entry from the copy also removes it from the original's partial matches.

Deep-copy the internal tree while retaining the shallow copy of stored values. Regression tests cover both copy entry points, changes in both directions, deletion, and preservation of value identity.

Validation: new regression cases fail before the change. Afterward, 21 selector/parser/resource tests and 2 subtests pass. The 116 configuration tests pass with 1 skip when run as __main__, with TEST_SRCDIR set and the existing tests/testdata fixture directory added to gin.testdata.__path__. TensorFlow/PyTorch integration suites were not run. git diff --check passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant