Skip to content

Commit ee3503b

Browse files
committed
Adjust static libpython detection
`dladdr` may only return the basename of the executable image, so we have to adjust the lookup accordingly.
1 parent 5bcd708 commit ee3503b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pythonnet/find_libpython/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ def _linked_libpython_unix():
9191
if retcode == 0: # means error
9292
return None
9393
path = os.path.realpath(dlinfo.dli_fname.decode())
94+
95+
# Compare basenames only, this should always be enough except for very
96+
# pathological cases
97+
if os.path.basename(path) == os.path.basename(os.path.realpath(sys.executable)):
98+
return None
9499
return path
95100

96101

0 commit comments

Comments
 (0)