-
Notifications
You must be signed in to change notification settings - Fork 171
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
Use pickle protocol format version 2. #633
Use pickle protocol format version 2. #633
Conversation
Codecov Report
@@ Coverage Diff @@
## master #633 +/- ##
=======================================
Coverage 75.29% 75.29%
=======================================
Files 30 30
Lines 2882 2882
=======================================
Hits 2170 2170
Misses 712 712
Continue to review full report at Codecov.
|
Cool, thanks for looking into this. The patch looks reasonable. Also, Have you also tried reading a dump created with python 2 in python 3? One thing I could see going wrong is that after loading in python 3 strings are now bytes instead, but maybe not. Some sort of test would be great for future regressions. A test that could run in just the current version that is being tested (be it pyhton 2 or 3):
Except for testing aspect, +1 on this PR |
Relevant documentation for observers: https://docs.python.org/3/library/pickle.html#pickle.dump Looks like the correct and least disruptive fix to me. It's nice that the docs specifically call out Python2 compatibility. |
Adds two test fixture files, a rosdep cache sample generated from python2 and one generated from python3 and makes sure that they both unpickle to the same data structure.
I tested this branch in both directions (updating with py2, reading with py3 and vice versa), and it seems to work fine, where master fails if py2 tries to read a py3 created cache. +1 for merging as is. |
@NikolausDemmel I have a branch that tests unpickling a file created with this branch in python2 and python3 produces equivalent data structures I just have to find time to get it cleaned up and pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Looks like the only failure is related to new warnings from flake8, so this should be ok to merge. It would be nice to fix those in a different pr. |
There is already #636 ;-) |
Fair enough :) Sorry I just haven't had the bandwidth to do anything here in a while. |
No worries, I can relate. Thanks for merging. :-) |
Proposed as a fix for #379.
So far this only #worksonmymachine. Following the queues from @NikolausDemmel in this comment I read through the docs and tried to use the cache created in python3 from python2 without the fix_imports flag and was successful so I did not apply it.
I have not added any tests of the unpickling. I'm not sure how effective such a test would be with a static blob and I don't know if we want to install python3 separately in all of the python2 environments.