]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45379: add custom error string for FROZEN_DISABLED (GH-29190)
authorFilipe Laíns <lains@riseup.net>
Thu, 28 Oct 2021 20:20:07 +0000 (21:20 +0100)
committerGitHub <noreply@github.com>
Thu, 28 Oct 2021 20:20:07 +0000 (22:20 +0200)
Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Gareth Rees <gdr@garethrees.org>
Misc/NEWS.d/next/Core and Builtins/2021-10-23-13-49-00.bpo-45379.ZF7G3n.rst [new file with mode: 0644]
Python/import.c

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 (file)
index 0000000..f8e2e50
--- /dev/null
@@ -0,0 +1,2 @@
+Clarify :exc:`ImportError` message when we try to explicitly import a
+frozen module but frozen modules are disabled.
index fe4686cd56b3ba37aa0510b081c129e9c879d4d7..15b1956c102df22777c07a133d6e9388e8aee06c 100644 (file)
@@ -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;