mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 05:40:09 +00:00
[lldb] Replace the usage of module imp with module importlib (#70443)
imp got removed in Python 3.12 [1] and the community recommends using importlib in newer Python versions. [1] https://docs.python.org/3.12/whatsnew/3.12.html#imp
This commit is contained in:
parent
b799080f19
commit
2260ebf7b6
@ -17,11 +17,12 @@ def find_lldb_root():
|
||||
|
||||
|
||||
lldb_root = find_lldb_root()
|
||||
import imp
|
||||
|
||||
fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root])
|
||||
try:
|
||||
imp.load_module("use_lldb_suite_root", fp, pathname, desc)
|
||||
finally:
|
||||
if fp:
|
||||
fp.close()
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
|
||||
path = os.path.join(lldb_root, "use_lldb_suite_root.py")
|
||||
loader = importlib.machinery.SourceFileLoader("use_lldb_suite_root", path)
|
||||
spec = importlib.util.spec_from_loader("use_lldb_suite_root", loader=loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
loader.exec_module(module)
|
||||
|
@ -20,11 +20,11 @@ def find_lldb_root():
|
||||
|
||||
lldb_root = find_lldb_root()
|
||||
|
||||
import imp
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
|
||||
fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root])
|
||||
try:
|
||||
imp.load_module("use_lldb_suite_root", fp, pathname, desc)
|
||||
finally:
|
||||
if fp:
|
||||
fp.close()
|
||||
path = os.path.join(lldb_root, "use_lldb_suite_root.py")
|
||||
loader = importlib.machinery.SourceFileLoader("use_lldb_suite_root", path)
|
||||
spec = importlib.util.spec_from_loader("use_lldb_suite_root", loader=loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
loader.exec_module(module)
|
||||
|
Loading…
Reference in New Issue
Block a user