Skip to content

Commit 993cbda

Browse files
committed
Use importlib
1 parent d62c5c2 commit 993cbda

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sphinxarg/ext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import importlib
34
import os
45
import shutil
56
import sys
@@ -496,7 +497,7 @@ def run(self):
496497
# Skip this if we're dealing with a local file, since it obviously can't be imported
497498
if 'filename' not in self.options:
498499
try:
499-
mod = __import__(module_name, globals(), locals(), [attr_name])
500+
mod = importlib.import_module(module_name)
500501
except ImportError as exc:
501502
raise self.error(
502503
f'Failed to import "{attr_name}" from "{module_name}".\n'

0 commit comments

Comments
 (0)