Skip to content
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