Commit 9fe988b
committed
Handle failure to call dlopen(NULL)
See the inline comment for the explanation.
I have been running into this bug on PyOxidizer when using
Python distributions built against musl libc. For reference:
$ ldd python/install/bin/python3.7m
not a dynamic executable
$ python/install/bin/python3.7m
Python 3.7.7 (default, Apr 5 2020, 06:02:52)
[Clang 9.0.1 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.CDLL(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/gps/src/pyoxidizer.git/build/python_distributions/python.c1ffa330c730/python/install/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: Dynamic loading not supported
Interestingly, OSError is incomplete (possibly a CPython ctypes bug?):
>>> try:
... ctypes.CDLL(None)
... except OSError as e:
... err = e
...
>>> err
OSError('Dynamic loading not supported')
>>> err.errno
None
>>> err.strerror
None
>>> err.args
('Dynamic loading not supported',)1 parent 61672bf commit 9fe988b
2 files changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
478 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
479 | 491 | | |
480 | 492 | | |
481 | 493 | | |
| |||
0 commit comments