⚡ Sangsakala Proxy 🏠 Home
Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Adjust static libpython detection
`dladdr` may only return the basename of the executable image, so we
have to adjust the lookup accordingly.
  • Loading branch information
filmor committed Feb 22, 2021
commit f092b70760fd981847be56437260f97e1e134eaa
7 changes: 5 additions & 2 deletions pythonnet/find_libpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ def _linked_libpython_unix():
ctypes.pointer(dlinfo))
if retcode == 0: # means error
return None
path = os.path.realpath(dlinfo.dli_fname.decode())
if path == os.path.realpath(sys.executable):
path = dlinfo.dli_fname.decode()

# Compare basenames only, this should always be enough except for very
# pathological cases
if os.path.basename(path) == os.path.basename(os.path.realpath(sys.executable)):
return None
return path

Expand Down