Skip to content
Closed
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
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 27, 2021
commit ee3503b25b0c475fc9dee74398107fc61ca411ab
5 changes: 5 additions & 0 deletions pythonnet/find_libpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def _linked_libpython_unix():
if retcode == 0: # means error
return None
path = os.path.realpath(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