Skip to content

Commit c2d0ba7

Browse files
FFY00ambv
andauthored
bpo-45379: clarify FROZEN_EXCLUDED and FROZEN_INVALID documentation (pythonGH-29189)
Signed-off-by: Filipe Laíns <[email protected]> Co-authored-by: Łukasz Langa <[email protected]>
1 parent e2e62b3 commit c2d0ba7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Python/import.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,10 @@ typedef enum {
11711171
FROZEN_BAD_NAME, // The given module name wasn't valid.
11721172
FROZEN_NOT_FOUND, // It wasn't in PyImport_FrozenModules.
11731173
FROZEN_DISABLED, // -X frozen_modules=off (and not essential)
1174-
FROZEN_EXCLUDED, // The PyImport_FrozenModules entry has NULL "code".
1175-
FROZEN_INVALID, // The PyImport_FrozenModules entry is bogus.
1174+
FROZEN_EXCLUDED, /* The PyImport_FrozenModules entry has NULL "code"
1175+
(module is present but marked as unimportable, stops search). */
1176+
FROZEN_INVALID, /* The PyImport_FrozenModules entry is bogus
1177+
(eg. does not contain executable code). */
11761178
} frozen_status;
11771179

11781180
static inline void
@@ -1305,6 +1307,7 @@ find_frozen(PyObject *nameobj, struct frozen_info *info)
13051307
return FROZEN_EXCLUDED;
13061308
}
13071309
if (p->code[0] == '\0' || p->size == 0) {
1310+
/* Does not contain executable code. */
13081311
return FROZEN_INVALID;
13091312
}
13101313
return FROZEN_OKAY;
@@ -1315,6 +1318,7 @@ unmarshal_frozen_code(struct frozen_info *info)
13151318
{
13161319
PyObject *co = PyMarshal_ReadObjectFromString(info->data, info->size);
13171320
if (co == NULL) {
1321+
/* Does not contain executable code. */
13181322
set_frozen_error(FROZEN_INVALID, info->nameobj);
13191323
return NULL;
13201324
}
@@ -2214,6 +2218,7 @@ _imp_get_frozen_object_impl(PyObject *module, PyObject *name,
22142218
info.nameobj = name;
22152219
}
22162220
if (info.size == 0) {
2221+
/* Does not contain executable code. */
22172222
set_frozen_error(FROZEN_INVALID, name);
22182223
return NULL;
22192224
}

0 commit comments

Comments
 (0)