Skip to content

Commit

Permalink
Return the error set.
Browse files Browse the repository at this point in the history
This fixes a subtle error when libcppyy-backend has all of its dependencies
loaded and it exits successfully at the first time.

In that case python thinks that the cdll object is the error set and tries to
iterate it causing a error:

```
Traceback (most recent call last):
  File "/opt/conda/envs/.venv/lib/python3.10/site-packages/cppyy/__init__.py", line 80, in <module>
    from ._cpython_cppyy import *
  File "/opt/conda/envs/.venv/lib/python3.10/site-packages/cppyy/_cpython_cppyy.py", line 21, in <module>
    c = loader.load_cpp_backend()
  File "/home/jovyan/cppyy-backend/python/cppyy_backend/loader.py", line 99, in load_cpp_backend
    c, err2 = _load_helper(name)
  File "/opt/conda/envs/.venv/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
TypeError: function name must be string, bytes object or integer
```
  • Loading branch information
vgvassilev committed Sep 10, 2023
1 parent 54f99fa commit efc1423
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/cppyy_backend/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _load_helper(bkname):

# normal load, allowing for user overrides of LD_LIBRARY_PATH
try:
return ctypes.CDLL(bkname, ctypes.RTLD_GLOBAL)
return ctypes.CDLL(bkname, ctypes.RTLD_GLOBAL), errors
except OSError as e:
errors.add(str(e))

Expand Down

0 comments on commit efc1423

Please sign in to comment.