DEP: Give a visible warning when align= to dtype is a non-bool#29301
DEP: Give a visible warning when align= to dtype is a non-bool#29301mattip merged 2 commits intonumpy:mainfrom
align= to dtype is a non-bool#29301Conversation
This seems generally confusing. I would like to make it keyword only, but this already gives a warning when loading _very_ old pickles, meaning I am not quite sure we should change away from a warning quickly. We should fix things around pickling and start pickling in a way that makes it easier to move to keyword only arguments. (I suppose one could detect the case of `np.dtype(obj, False, True)` and assume it is via unpickling, but... I am assuming that it is OK to (eventually) break unpickling these 10+ year old files, but I am not in a rush to actually do so and go through with the deprecation. Signed-off-by: Sebastian Berg <[email protected]>
Co-authored-by: Matti Picus <[email protected]>
|
Thanks @seberg |
|
FWIW, I just hit this after upgrading my numpy version to 2.4 when loading old HDF5 files created via Pandas (which used PyTables). This is extremely annoying because we have a lot of data archived in those files and I never realized until now that H5 (created via pytables) was not a good archival format and could have forward compatibility problems 😞. I am not saying the deprecation should be reverted or anything... I understand the motivation of the change... But I am really not enthusiastic at the idea of rewriting all those old files 😭. |
|
It would be nice to figure out a way to deprecate it but avoid the deprecation with pickles. The only path I can think of right now is to use (I guess HDF5 is just pickle for object arrays? Not sure I know why hdf5 files would have pickles of dtypes... or maybe as some metadata...) |
This seems generally confusing. I would like to make it keyword only, but this already gives a warning when loading very old pickles, meaning I am not quite sure we should change away from a warning quickly.
We should fix things around pickling and start pickling in a way that makes it easier to move to keyword only arguments. (I suppose one could detect the case of
np.dtype(obj, False, True)and assume it is via unpickling, but...I am assuming that it is OK to (eventually) break unpickling these 10+ year old files, but I am not in a rush to actually do so and go through with the deprecation.
Closes gh-8158
The one way to really avoid all of those warnings for ancient pickles, might be to just explicitly accept
np.dtype(obj, 0, 1)(and maybe the currentnp.dtype(obj, False, True)) exactly, basically just hoping that such a call came from pickle.That is a whim, but users are unlikely to pass those exact parameters in practice probably...