diff options
author | Filipe Laíns <lains@riseup.net> | 2021-10-29 20:55:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 20:55:14 (GMT) |
commit | c2d0ba722a7b3839685af968cf0c304a24cdf525 (patch) | |
tree | 2b6b9c80379ed081a34ab915180b85d3a7eb1894 /Python | |
parent | e2e62b3808691e15fa44b883270023e42dcad958 (diff) | |
download | cpython-c2d0ba722a7b3839685af968cf0c304a24cdf525.zip cpython-c2d0ba722a7b3839685af968cf0c304a24cdf525.tar.gz cpython-c2d0ba722a7b3839685af968cf0c304a24cdf525.tar.bz2 |
bpo-45379: clarify FROZEN_EXCLUDED and FROZEN_INVALID documentation (GH-29189)
Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c index 48ea912..cdcb903 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1171,8 +1171,10 @@ typedef enum { FROZEN_BAD_NAME, // The given module name wasn't valid. FROZEN_NOT_FOUND, // It wasn't in PyImport_FrozenModules. FROZEN_DISABLED, // -X frozen_modules=off (and not essential) - FROZEN_EXCLUDED, // The PyImport_FrozenModules entry has NULL "code". - FROZEN_INVALID, // The PyImport_FrozenModules entry is bogus. + FROZEN_EXCLUDED, /* The PyImport_FrozenModules entry has NULL "code" + (module is present but marked as unimportable, stops search). */ + FROZEN_INVALID, /* The PyImport_FrozenModules entry is bogus + (eg. does not contain executable code). */ } frozen_status; static inline void @@ -1305,6 +1307,7 @@ find_frozen(PyObject *nameobj, struct frozen_info *info) return FROZEN_EXCLUDED; } if (p->code[0] == '\0' || p->size == 0) { + /* Does not contain executable code. */ return FROZEN_INVALID; } return FROZEN_OKAY; @@ -1315,6 +1318,7 @@ unmarshal_frozen_code(struct frozen_info *info) { PyObject *co = PyMarshal_ReadObjectFromString(info->data, info->size); if (co == NULL) { + /* Does not contain executable code. */ set_frozen_error(FROZEN_INVALID, info->nameobj); return NULL; } @@ -2214,6 +2218,7 @@ _imp_get_frozen_object_impl(PyObject *module, PyObject *name, info.nameobj = name; } if (info.size == 0) { + /* Does not contain executable code. */ set_frozen_error(FROZEN_INVALID, name); return NULL; } |