bpo-41006: importlib.util no longer imports typing (GH-20938)

Create importlib._abc submodule to avoid importing typing when
importlib.util is imported. Move Loader ABC into importlib._abc.
This commit is contained in:
Victor Stinner 2020-06-17 23:15:59 +02:00 committed by GitHub
parent 236a0f5cf0
commit 9e09849d20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 51 deletions

View file

@ -650,8 +650,8 @@ class FactoryTests:
# Need to use a circuitous route to get at importlib.machinery to make
# sure the same class object is used in the isinstance() check as
# would have been used to create the loader.
self.assertIsInstance(spec.loader,
self.util.abc.machinery.SourceFileLoader)
SourceFileLoader = self.util.spec_from_file_location.__globals__['SourceFileLoader']
self.assertIsInstance(spec.loader, SourceFileLoader)
self.assertEqual(spec.loader.name, self.name)
self.assertEqual(spec.loader.path, self.path)
self.assertEqual(spec.origin, self.path)