While debugging #15186, I discovered that the following code hit an assert(in1 != NULL) in the inner loop:
>>> a = np.array([0], dtype=object)
>>> b = np.tensordot(a[1:], a[:1], axes=((0,), (0,))
>>> b
array(None, dtype=object)
>>> b.shape
()
>>> b += 1
python: ../numpy/core/src/umath/loops.c.src:259: PyUFunc_OO_O: Assertion `in1 != NULL' failed
The assert is only active when debugging. This does not segfault:
>>> c = np.array(None, dtype=object)
>>> c += 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'