The following code fails to complete and has to be interrupted with CTRL-\:
import cothread
import numpy
def ticker():
print('Hello')
print(numpy.std([]))
print('End')
cothread.Spawn(ticker)
cothread.Yield()
print('Bye')
Ths generates the following output (I have elided the full paths for clarity):
Hello
.../site-packages/numpy/core/_methods.py:263: RuntimeWarning: Degrees of freedom <= 0 for slice
keepdims=keepdims, where=where)
^\Quit (core dumped)
One interesting detail of note: only one of three warnings is generated in this case, if numpy.std([]) is computed outside of a cothread the following is printed:
.../site-packages/numpy/core/_methods.py:263: RuntimeWarning: Degrees of freedom <= 0 for slice
keepdims=keepdims, where=where)
.../site-packages/numpy/core/_methods.py:223: RuntimeWarning: invalid value encountered in true_divide
arrmean, rcount, out=arrmean, casting='unsafe', subok=False)
.../site-packages/numpy/core/_methods.py:254: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)
nan
This is tested for Python 3.7.2 and cothread version 2.19.1.
The following code fails to complete and has to be interrupted with
CTRL-\:Ths generates the following output (I have elided the full paths for clarity):
One interesting detail of note: only one of three warnings is generated in this case, if
numpy.std([])is computed outside of a cothread the following is printed:This is tested for Python 3.7.2 and cothread version 2.19.1.