8000 gh-117953: Add Internal struct _Py_ext_module_loader_info by ericsnowcurrently · Pull Request #118194 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117953: Add Internal struct _Py_ext_module_loader_info #118194

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
Add _Py_ext_module_loader_info.path.
  • Loading branch information
ericsnowcurrently committed Apr 24, 2024
commit 425c5e068c6ec85699144b4dd179f6761fb0025c
3 changes: 3 additions & 0 deletions Include/internal/pycore_importdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ struct _Py_ext_module_loader_info {
#endif
PyObject *name;
PyObject *name_encoded;
/* path is always a borrowed ref of name or filename,
* depending on if it's builtin or not. */
PyObject *path;
const char *hook_prefix;
const char *newcontext;
};
Expand Down
5 changes: 5 additions & 0 deletions Python/importdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ _Py_ext_module_loader_info_init(struct _Py_ext_module_loader_info *p_info,
return -1;
}
#endif

info.path = info.filename;
}
else {
info.path = info.name;
}

*p_info = info;
Expand Down
0