From 233841ab782953510ad308dc6173072a6cc6a1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 28 Oct 2021 21:20:07 +0100 Subject: bpo-45379: add custom error string for FROZEN_DISABLED (GH-29190) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe LaĆ­ns Co-authored-by: Gareth Rees --- .../next/Core and Builtins/2021-10-23-13-49-00.bpo-45379.ZF7G3n.rst | 2 ++ Python/import.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-10-23-13-49-00.bpo-45379.ZF7G3n.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-10-23-13-49-00.bpo-45379.ZF7G3n.rst b/Misc/NEWS.d/next/Core and Builtins/2021-10-23-13-49-00.bpo-45379.ZF7G3n.rst new file mode 100644 index 0000000..f8e2e50 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2021-10-23-13-49-00.bpo-45379.ZF7G3n.rst @@ -0,0 +1,2 @@ +Clarify :exc:`ImportError` message when we try to explicitly import a +frozen module but frozen modules are disabled. diff --git a/Python/import.c b/Python/import.c index fe4686c..15b1956 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1153,9 +1153,11 @@ set_frozen_error(frozen_status status, PyObject *modname) switch (status) { case FROZEN_BAD_NAME: case FROZEN_NOT_FOUND: - case FROZEN_DISABLED: err = "No such frozen object named %R"; break; + case FROZEN_DISABLED: + err = "Frozen modules are disabled and the frozen object named %R is not essential"; + break; case FROZEN_EXCLUDED: err = "Excluded frozen object named %R"; break; -- cgit v0.12