hgdemandimport/demandimportpy3.py
branchstable
changeset 44819 a6e12d477595
parent 44118 f81c17ec303c
child 45755 8ed69bd42f10
--- a/hgdemandimport/demandimportpy3.py	Thu May 07 23:40:05 2020 +0200
+++ b/hgdemandimport/demandimportpy3.py	Tue May 12 01:03:12 2020 +0200
@@ -97,9 +97,18 @@
     def __setattr__(self, name, value):
         return setattr(object.__getattribute__(self, "_finder"), name, value)
 
-    def find_spec(self, *args, **kwargs):
+    def find_spec(self, fullname, path, target=None):
         finder = object.__getattribute__(self, "_finder")
-        spec = finder.find_spec(*args, **kwargs)
+        try:
+            find_spec = finder.find_spec
+        except AttributeError:
+            loader = finder.find_module(fullname, path)
+            if loader is None:
+                spec = None
+            else:
+                spec = importlib.util.spec_from_loader(fullname, loader)
+        else:
+            spec = find_spec(fullname, path, target)
 
         # Lazy loader requires exec_module().
         if (