bpo-37444: Update differing exception between builtins and importlib (GH-14869)



Imports now raise `TypeError` instead of `ValueError` for relative import failures. This makes things consistent between `builtins.__import__` and `importlib.__import__` as well as using a more natural import for the failure.


https://bugs.python.org/issue37444



Automerge-Triggered-By: @brettcannon
diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py
index 201e0f4..269a6fa 100644
--- a/Lib/importlib/util.py
+++ b/Lib/importlib/util.py
@@ -29,8 +29,8 @@
     if not name.startswith('.'):
         return name
     elif not package:
-        raise ValueError(f'no package specified for {repr(name)} '
-                         '(required for relative module names)')
+        raise ImportError(f'no package specified for {repr(name)} '
+                          '(required for relative module names)')
     level = 0
     for character in name:
         if character != '.':