Skip to content

fix: respect module boundaries when clearing imports - #830

Open
Shubham-Padkonde wants to merge 1 commit into
google:mainfrom
Shubham-Padkonde:fix/module-reload-name-boundaries
Open

Shubham-Padkonde wants to merge 1 commit into
google:mainfrom
Shubham-Padkonde:fix/module-reload-name-boundaries

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Recursive module selection uses a raw string-prefix match, so clearing a package named foo can also remove foo_extra and its children from sys.modules. This affects clear_cached_modules and its reload callers.

Match exact requested module names or names beginning with the requested name plus a dot. Tests cover recursive and non-recursive selection, multiple roots, empty selection, and actual cache clearing while retaining a similarly named sibling.

Validation: both new tests fail before the change; all three adhoc utility tests pass afterward. git diff --check passes. Pyink accepts the tests; it requests only pre-existing formatting of the path-normalization expression in the implementation file.

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