-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Add sys.runtime_library
#129492
Comments
What is the runtime library path? |
It's |
When Python is built as a shared library, the path to that library. $ ldd `which python3`
linux-vdso.so.1 (0x00007ffc3ddbe000)
libpython3.12.so.1.0 => /lib64/libpython3.12.so.1.0 (0x00007fe292720000) # This path
libc.so.6 => /lib64/libc.so.6 (0x00007fe29252f000)
libm.so.6 => /lib64/libm.so.6 (0x00007fe29244b000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe292d06000) It's the value provided for the It's very much a CPython implementation detail though, since even CPython doesn't define it when statically linked. (The same is also true of Checking what $ python3 -c "from sysconfig import get_config_var as gcv; import os.path; print(os.path.join(gcv('base'), gcv('platlibdir'), gcv('LDLIBRARY')))"
/usr/lib64/libpython3.12.so |
What is it useful for? And why is calculating it from In getpath, we use it because Windows historically would resolve the stdlib against the DLL, and later we resolve
Footnotes
|
What are the use cases for exposing this more widely? |
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 insys
.cpython/Modules/getpath.c
Lines 805 to 829 in 10ee2d9
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 tosysconfig
instead.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
The text was updated successfully, but these errors were encountered: