summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index 51b779c..be60c43 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1297,13 +1297,21 @@ find_frozen(PyObject *nameobj, struct frozen_info *info)
info->nameobj = nameobj; // borrowed
info->data = (const char *)p->code;
info->get_code = p->get_code;
- info->size = p->size < 0 ? -(p->size) : p->size;
- info->is_package = p->size < 0 ? true : false;
+ info->size = p->size;
+ info->is_package = p->is_package;
+ if (p->size < 0) {
+ // backward compatibility with negative size values
+ info->size = -(p->size);
+ info->is_package = true;
+ }
info->origname = name;
info->is_alias = resolve_module_alias(name, _PyImport_FrozenAliases,
&info->origname);
}
-
+ if (p->code == NULL && p->size == 0 && p->get_code != NULL) {
+ /* It is only deepfrozen. */
+ return FROZEN_OKAY;
+ }
if (p->code == NULL) {
/* It is frozen but marked as un-importable. */
return FROZEN_EXCLUDED;
@@ -2224,7 +2232,7 @@ _imp_get_frozen_object_impl(PyObject *module, PyObject *name,
if (info.nameobj == NULL) {
info.nameobj = name;
}
- if (info.size == 0) {
+ if (info.size == 0 && info.get_code == NULL) {
/* Does not contain executable code. */
set_frozen_error(FROZEN_INVALID, name);
return NULL;