Skip to content

Commit

Permalink
Fix find_spec for old finders that don't implement it.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed Dec 9, 2024
1 parent 9479123 commit 134165c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions site-packages/_numba_cuda_redirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ def find_spec(self, name, path, target=None):
oot_path = [p.replace(self.numba_path, self.numba_cuda_path)
for p in path]
for finder in sys.meta_path:
spec = finder.find_spec(name, oot_path, target)
if spec is not None:
return spec
try:
spec = finder.find_spec(name, oot_path, target)
except AttributeError:
# Finders written to a pre-Python 3.4 spec for finders will not
# implement find_spec. We can skip those altogether.
continue
else:
if spec is not None:
return spec


finder = NumbaCudaFinder()
Expand Down

0 comments on commit 134165c

Please sign in to comment.