After applying the changes from #27636:
>>> print(repr(np.strings.replace(
np.array(["hello planet"], dtype="U"),
np.array("planet", dtype="T"),
np.array("world", dtype="T"))))
array(['hello world'], dtype='<U11')
We get a unicode array back, despite the fact that StringDType explicitly installs a promoter for this case.
I thought this had something to do with the fact that the legacy string unicode promoters work by constructing a promoter DType tuple that's filled with None entries. But that's fine, since None has less priority than a specific DType.
Instead something else is going on. I got as far as tracing through the call to resolve_descriptors, which does correctly set the output DType to StringDType, so something else fishy is going on later when the actual output array is created.
Reactions are currently unavailable
After applying the changes from #27636:
>>> print(repr(np.strings.replace( np.array(["hello planet"], dtype="U"), np.array("planet", dtype="T"), np.array("world", dtype="T")))) array(['hello world'], dtype='<U11')We get a unicode array back, despite the fact that StringDType explicitly installs a promoter for this case.
I thought this had something to do with the fact that the legacy string unicode promoters work by constructing a promoter DType tuple that's filled with None entries. But that's fine, since None has less priority than a specific DType.
Instead something else is going on. I got as far as tracing through the call to resolve_descriptors, which does correctly set the output DType to StringDType, so something else fishy is going on later when the actual output array is created.