Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct attribute error on module spec loader
The loader attribute on a module spec is technically optional, so mypy raises a `[union-attr]` error: Item "_Loader" of "Optional[_Loader]" has no attribute "exec_module" To avoid referencing the potentially undefined `_Loader.exec_module` attribute, this commit will update the syntax to get the attribute with `getattr(spec.loader, "exec_module")` prior to running `exec_module()`. An `AttributeError` will be raised if the attribute does not exist.
- Loading branch information