Skip to content

Commit 6b834e5

Browse files
vyasrgmarkall
authored andcommitted
Fix find_spec for old finders that don't implement it.
1 parent f57706f commit 6b834e5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

site-packages/_numba_cuda_redirector.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ def find_spec(self, name, path, target=None):
6767
oot_path = [p.replace(self.numba_path, self.numba_cuda_path)
6868
for p in path]
6969
for finder in sys.meta_path:
70-
spec = finder.find_spec(name, oot_path, target)
71-
if spec is not None:
72-
return spec
70+
try:
71+
spec = finder.find_spec(name, oot_path, target)
72+
except AttributeError:
73+
# Finders written to a pre-Python 3.4 spec for finders will not
74+
# implement find_spec. We can skip those altogether.
75+
continue
76+
else:
77+
if spec is not None:
78+
return spec
7379

7480

7581
finder = NumbaCudaFinder()

0 commit comments

Comments
 (0)