After stripping back code to the absolute minimum that reproduces this error, I am having this:
l_signal = array.array('i', [0] * 10)
for i in range(0, 10):
l_signal[i] = i
Which reproduces the error. I have absolutely no clue why.
Python 3.10.12