Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pythonnet/find_libpython/__init__.py
Original file line number Diff line number Diff line change
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