Skip to content

Commit 233841a

Browse files
FFY00gareth-rees
andauthored
bpo-45379: add custom error string for FROZEN_DISABLED (GH-29190)
Signed-off-by: Filipe Laíns <[email protected]> Co-authored-by: Gareth Rees <[email protected]>
1 parent 7401694 commit 233841a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Clarify :exc:`ImportError` message when we try to explicitly import a
2+
frozen module but frozen modules are disabled.

Python/import.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,11 @@ set_frozen_error(frozen_status status, PyObject *modname)
11531153
switch (status) {
11541154
case FROZEN_BAD_NAME:
11551155
case FROZEN_NOT_FOUND:
1156-
case FROZEN_DISABLED:
11571156
err = "No such frozen object named %R";
11581157
break;
1158+
case FROZEN_DISABLED:
1159+
err = "Frozen modules are disabled and the frozen object named %R is not essential";
1160+
break;
11591161
case FROZEN_EXCLUDED:
11601162
err = "Excluded frozen object named %R";
11611163
break;

0 commit comments

Comments
 (0)