Skip to content

Commit 425c5e0

Browse files
Add _Py_ext_module_loader_info.path.
1 parent 481bf5d commit 425c5e0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Include/internal/pycore_importdl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ struct _Py_ext_module_loader_info {
2424
#endif
2525
PyObject *name;
2626
PyObject *name_encoded;
27+
/* path is always a borrowed ref of name or filename,
28+
* depending on if it's builtin or not. */
29+
PyObject *path;
2730
const char *hook_prefix;
2831
const char *newcontext;
2932
};

Python/importdl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ _Py_ext_module_loader_info_init(struct _Py_ext_module_loader_info *p_info,
147147
return -1;
148148
}
149149
#endif
150+
151+
info.path = info.filename;
152+
}
153+
else {
154+
info.path = info.name;
150155
}
151156

152157
*p_info = info;

0 commit comments

Comments
 (0)