Simple Python Program with Juliacall Segfaults

This simple Python program calling a Julia function crashes sporadically with segfault.

# juliacall_compute_square.py
from juliacall import Main as jl
print(f"julia version : {jl.VERSION}")
numstring = input("Enter a number\n")
num = jl.parse(jl.Int, numstring)
print(num**2)

I tried running it 10 times in Linux Bash shell:

for i in {1..10}; do
    echo 50 | python juliacall_compute_square.py
done

I see 4 segfaults out of the 10 calls. I have Python 3.13.3, juliacall 0.9.28, Julia 1.12.1 with versioninfo() printout below:

Commit ba1e628ee49 (2025-10-17 13:02 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 22 × Intel(R) Core(TM) Ultra 9 185H
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 22 virtual cores)

Setting the environment variable PYTHON_JULIACALL_THREADS=1 seems to help.