diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index ec2e56f6ea9ca1..2c1ef4b202d5dd 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -826,8 +826,9 @@ def _module_repr_from_spec(spec): if spec.origin is None: if spec.loader is None: return f'' - else: + if isinstance(spec.loader, _bootstrap_external.NamespaceLoader): return f'' + return f'' else: if spec.has_location: return f''