-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed as not planned
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
It would be useful to expose the runtime library path, if any, as a sys module attribute.
This is already implemented for getpath, we can easily make this information also available in sys.
Lines 805 to 829 in 10ee2d9
| /* Add the runtime library's path to the dict */ | |
| static int | |
| library_to_dict(PyObject *dict, const char *key) | |
| { | |
| /* macOS framework builds do not link against a libpython dynamic library, but | |
| instead link against a macOS Framework. */ | |
| #if defined(Py_ENABLE_SHARED) || defined(WITH_NEXT_FRAMEWORK) | |
| #ifdef MS_WINDOWS | |
| extern HMODULE PyWin_DLLhModule; | |
| if (PyWin_DLLhModule) { | |
| return winmodule_to_dict(dict, key, PyWin_DLLhModule); | |
| } | |
| #endif | |
| #if HAVE_DLADDR | |
| Dl_info libpython_info; | |
| if (dladdr(&Py_Initialize, &libpython_info) && libpython_info.dli_fname) { | |
| return decode_to_dict(dict, key, libpython_info.dli_fname); | |
| } | |
| #endif | |
| #endif | |
| return PyDict_SetItemString(dict, key, Py_None) == 0; | |
| } |
I'm proposing sys, as I think that's what makes the most logical sense, but people are not too keen on it, we could add it to sysconfig instead.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtype-featureA feature request or enhancementA feature request or enhancement