Skip to content

Commit

Permalink
Replace find_module function
Browse files Browse the repository at this point in the history
find_module function was deprecated in Python 3.4 [1] and later removed
in Python 3.12 [2], the find_spec function should be used instead. This
change is necessary for proper Python 3.12 support.

[1] https://docs.python.org/3.4/library/importlib.html#importlib.abc.MetaPathFinder.find_module
[2] python/cpython#98040

Change-Id: I8354918d6548192dea3492eb2ee682d323559912
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
  • Loading branch information
arkamar committed Jun 21, 2023
1 parent 6a1bc5b commit 104cb89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion oslotest/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ class _NoModuleFinder(object):
def __init__(self, module):
self.module = module

def find_module(self, fullname, path):
def find_spec(self, fullname, path, target):
if fullname == self.module or fullname.startswith(self.module + '.'):
raise ImportError

0 comments on commit 104cb89

Please sign in to comment.