##// END OF EJS Templates
py3: handle meta-path finders that only use pre-python3.4 API
Ludovic Chabant -
r42394:7ed472e7 default
parent child Browse files
Show More
@@ -54,7 +54,16 b' if sys.version_info[0] >= 3:'
54 if finder == self:
54 if finder == self:
55 continue
55 continue
56
56
57 spec = finder.find_spec(fullname, path, target=target)
57 # Originally the API was a `find_module` method, but it was
58 # renamed to `find_spec` in python 3.4, with a new `target`
59 # argument.
60 find_spec_method = getattr(finder, 'find_spec', None)
61 if find_spec_method:
62 spec = find_spec_method(fullname, path, target=target)
63 else:
64 spec = finder.find_module(fullname)
65 if spec is not None:
66 spec = importlib.util.spec_from_loader(fullname, spec)
58 if spec:
67 if spec:
59 break
68 break
60
69
General Comments 0
You need to be logged in to leave comments. Login now