From e21726d6b9d7590a1d0a32c989a15c317009fed1 Mon Sep 17 00:00:00 2001 From: Shantanu Jain Date: Sun, 26 Nov 2023 20:36:51 -0800 Subject: [PATCH] gh-112414: Fix repr for custom loader --- Lib/importlib/_bootstrap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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''