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

Adjust static libpython detection #1396

Merged
merged 2 commits into from Feb 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions pythonnet/find_libpython/__init__.py
Expand Up @@ -77,6 +77,9 @@ class Dl_info(ctypes.Structure):


def _linked_libpython_unix():
if not sysconfig.get_config_var("Py_ENABLE_SHARED"):
return None

libdl = ctypes.CDLL(ctypes.util.find_library("dl"))
libdl.dladdr.argtypes = [ctypes.c_void_p, ctypes.POINTER(Dl_info)]
libdl.dladdr.restype = ctypes.c_int
Expand All @@ -88,8 +91,6 @@ def _linked_libpython_unix():
if retcode == 0: # means error
return None
path = os.path.realpath(dlinfo.dli_fname.decode())
if path == os.path.realpath(sys.executable):
return None
return path


Expand Down