There's an admittedly edge case that changed behaviour, probably due to the type promotion changes:
>>> import numpy as np
>>> np.array([''], dtype=object).astype('U')
On 1.20.3 this returns
whereas on the 1.21.0rc1 release candidate this is an error:
>>> np.array([''], dtype=object).astype('U')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Cannot cast array data from dtype('O') to dtype('<U') according to the rule 'unsafe'
I note that casting scalar strings or non-empty arrays still works:
>>> np.array('', dtype=object).astype('U')
array('', dtype='<U1')
>>> np.array(['a'], dtype=object).astype('U')
array(['a'], dtype='<U1')
Is this new error expected?