Skip to content

Fix handling of case where spec.origin is None in get_module_members.#20

Merged
copybara-service[bot] merged 1 commit intomainfrom
test_892247344
Mar 31, 2026
Merged

Fix handling of case where spec.origin is None in get_module_members.#20
copybara-service[bot] merged 1 commit intomainfrom
test_892247344

Conversation

@copybara-service
Copy link
Copy Markdown

Fix handling of case where spec.origin is None in get_module_members.

There were a few issues here that this CL fixes:

  1. We didn't explicitly import importlib.util, which meant that type-checking was not enabled for importlib.util.find_spec and its returned value.
  2. The documentation (and the type info that we failed to load) state that spec.origin can be None, but we weren't checking for this.
  3. We checked the existence of the file and then opened it, which is a classic filesystem race-condition.

PiperOrigin-RevId: 892502816
@copybara-service copybara-service bot merged commit 529dca0 into main Mar 31, 2026
@copybara-service copybara-service bot deleted the test_892247344 branch March 31, 2026 20:10
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