-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pickle protocol #143
Fix pickle protocol #143
Conversation
Protocol version 4 is supported since Python 3.4 and the default starting with Python 3.8.
Thanks, Ole! This fixes my problem with starting PyRAF under 3.7 after initially creating the cache under 3.9 (both with this branch). However, if I start PyRAF under 3.7 with an existing cache entry for "gemini" that was created using 2.2.1 under Python 3.8, I get this when trying to load the package:
Not sure how much we care about that (I have a meeting now, so don't have much time to think about it) but it doesn't seem as intended? |
The above error (from the new |
50abdfe
to
df93165
Compare
This way we make sure that we unpickle only objects with a supported pickle format version.
df93165
to
7f748ef
Compare
The idea was that when the id is not there, the old version is overwritten by one with a new pickle version. This however appears not to work. |
That version seems fine, thanks (on Linux). I suppose it will mean more old duplicate entries sitting around, but I never really see more than a few MB and people can delete them if they want to. |
That is true; however this will happen also when we introduce another incompatible change (which changes the version of the cache). And I think that we will very rarely change the pickle protocol in future. |
Hi! I don't think this has been added to the latest version, right? pip installs pyraf v2.2.1, but this fix is not included. |
No, it is not included in 2.2.1. I didn't make a new release because downgrading Python seemed a rare case, and one can work around the problem by removing the cache after downgrading. |
Protocol version 4 is supported since Python 3.4 and the default starting with Python 3.8.
Fixing the protocol version allows to downgrade the Python version. To make it more robust, also trigger a re-build of the cache entry if the cache was written by an unsupported protocol version.
Fixes #142.