From e7a5fad70b0b03a62bc05c6a78252fbfedd0cc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sat, 23 Oct 2021 13:23:12 +0100 Subject: [PATCH 1/3] bpo-45379: clarify FROZEN_EXCLUDED documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Python/import.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python/import.c b/Python/import.c index fe4686cd56b3ba..9ec68fa272ff80 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1142,7 +1142,8 @@ 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_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. } frozen_status; From fad1a660f087b1ff9ba452676c137bacad6220cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sat, 23 Oct 2021 13:40:12 +0100 Subject: [PATCH 2/3] clarify FROZEN_INVALID documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Python/import.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Python/import.c b/Python/import.c index 9ec68fa272ff80..389cb149613e93 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1144,7 +1144,8 @@ typedef enum { FROZEN_DISABLED, // -X frozen_modules=off (and not essential) 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. + FROZEN_INVALID, /* The PyImport_FrozenModules entry is bogus. + (eg. does not contain executable code) */ } frozen_status; static inline void @@ -1237,6 +1238,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; @@ -1247,6 +1249,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; } @@ -2146,6 +2149,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; } From 478bd22b5e86280787340535649420e544bc74de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Thu, 28 Oct 2021 22:21:32 +0200 Subject: [PATCH 3/3] Fix punctuation --- Python/import.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/import.c b/Python/import.c index 389cb149613e93..5b17797c5b4c3b 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1144,8 +1144,8 @@ typedef enum { FROZEN_DISABLED, // -X frozen_modules=off (and not essential) 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_INVALID, /* The PyImport_FrozenModules entry is bogus + (eg. does not contain executable code). */ } frozen_status; static inline void