Here’s the Python code which extracts a tuple of two Julia arrays from the juliacall
interface and converts them to numpy arrays. The code is an infinite loop, but crashes sporadically after a few million iterations with segfault:
# juliacall_problem1.py
from juliacall import Main as jl
import numpy as np
counter = 0
while True:
counter += 1
try:
a, b = jl.seval("(fill(0f0, 3, 8, 8), fill(true, 3, 8, 8))")
c, d = np.array(a), np.array(b)
except:
print(f"Failed while {type(a) = }, {type(b) = }")
break
print(f"Failed after {counter} iterations")
Here’s the result when I run the above script:
# python juliacall_problem1.py
/home/username/scratch/juliacall_problem1.py:8: DeprecationWarning: __array__ implementation doesn't accept a copy keyword, so passing copy=False failed. __array__ must implement 'dtype' and 'copy' keyword arguments. To learn more, see the migration guide https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword
c, d = np.array(a), np.array(b)
Failed while type(a) = <class 'juliacall.ArrayValue'>, type(b) = <class 'juliacall.ArrayValue'>
Failed after 2994923 iterations
Segmentation fault (core dumped) python juliacall_problem1.py
Versions: Linux x86_64, Python 3.13.3, julicall 0.9.25, Julia 1.11.5.
Maybe I should file an issue on GitHub?