8000 bpo-45020: Identify which frozen modules are actually aliases. by ericsnowcurrently · Pull Request #28655 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-45020: Identify which frozen modules are actually aliases. #28655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Prev Previous commit
Next Next commit
Use resolve_module_alias() in find_frozen().
  • Loading branch information
ericsnowcurrently committed Oct 5, 2021
commit 2800c6725365eacc1d70c0f3a5bb7910c3333dfe
10 changes: 6 additions & 4 deletions Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,16 +1184,15 @@ struct frozen_info {
const char *data;
Py_ssize_t size;
bool is_package;
bool is_alias;
const char *origname;
};

static frozen_status
find_frozen(PyObject *nameobj, struct frozen_info *info)
{
if (info != NULL) {
info->nameobj = NULL;
info->data = NULL;
info->size = 0;
info->is_package = false;
memset(info, 0, sizeof(*info));
}

if (nameobj == NULL || nameobj == Py_None) {
Expand Down Expand Up @@ -1228,6 +1227,9 @@ find_frozen(PyObject *nameobj, struct frozen_info *info)
info->data = (const char *)p->code;
info->size = p->size < 0 ? -(p->size) : p->size;
info->is_package = p->size < 0 ? true : false;
info->origname = name;
info->is_alias = resolve_module_alias(name, _PyImport_FrozenAliases,
&info->origname);
}

if (p->code == NULL) {
Expand Down
0