Skip to content

Commit

Permalink
Fix Python 3.12 import AttributeError (#7482)
Browse files Browse the repository at this point in the history
Fixes #7458

### Description


https://github.com/python/cpython/blob/a21c0c7def9a8495f1166d9b434dfc301cb92bff/Lib/importlib/abc.py#L68

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
  • Loading branch information
KumoLiu authored Feb 21, 2024
1 parent df37a22 commit 1b93988
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion monai/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def load_submodules(
if (is_pkg or load_all) and name not in sys.modules and match(exclude_pattern, name) is None:
try:
mod = import_module(name)
importer.find_module(name).load_module(name) # type: ignore
importer.find_spec(name).loader.load_module(name) # type: ignore
submodules.append(mod)
except OptionalImportError:
pass # could not import the optional deps., they are ignored
Expand Down

0 comments on commit 1b93988

Please sign in to comment.