Uh oh!
There was an error while loading. Please reload this page.
Restore compatibility with functions pickled with 0.4.0 - #128
Conversation
Release 0.4.1 introduced a change to arguments of _fill_function which meant that functions pickled before that couldn't be unpickled anymore. Addresses cloudpipe#126
I'm getting this error when unpickling with Python 3 (no stacktrace): ``` TypeError: an integer is required (got type str) ```
Codecov Report
@@ Coverage Diff @@## master #128 +/- ##
==========================================
+ Coverage 83.94% 84.09% +0.15%
==========================================
Files 2 2 Lines 517 522 +5 Branches 90 91 +1 ==========================================
+ Hits 434 439 +5
Misses 62 62 Partials 21 21
Continue to review full report at Codecov.
|
nikhaldi
commented
Oct 31, 2017
I'm not very happy I had to skip the tests for Python 3. My pickle/Python 3 knowledge is not deep, gladly taking suggestions for handling this better. Worst case, I could add separate set of tests for Python 3. |
ogrisel
commented
Oct 31, 2017
LGTM as it is. In the long run we should probably setup a folder of sample pickle files to check version compat for the latest 2 consecutive versions but I would rather not delay 0.4.2 for this. |
ogrisel
commented
Nov 2, 2017
Actually, this does not address @pitrou's comment in #126 (comment): something pickled in 0.4.2 won't be loadable in 0.4.0. But I don't see how it can be fixed. |
nikhaldi
commented
Nov 2, 2017
Agreed, I don't think there's any way to restore forward compatibility now. Like I said elsewhere, ultimately I think you need to carry around a protocol version marker somewhere. Then you can at least give an explicit error if you get a pickle of a version that you can't support. |
nikhaldi
commented
Nov 2, 2017
Actually, I take that back - there are ways to restore forward compatibility but they may be quite hacky. Basically, the |
pitrou
commented
Nov 2, 2017
@nikhaldi or we bite the bullet and transform |
nikhaldi
commented
Nov 2, 2017
@pitrou yeah, obviously at some point you have to redesign Ok, here's a fix which actually makes pickles compatible with 0.4.0 again: https://github.com/nikhaldi/cloudpickle/compare/feat/function_pickle_compat...nikhaldi:feat/function_pickle_forward_compat?expand=1 It works but it's a hack. I could be convinced to include this or not, I don't have strong feelings either way. |
pitrou
commented
Nov 2, 2017
Then let's redesign it now. Since we just broke compatibility, we might as well break it soon again than wait for next year.
I'd rather avoid this :-) |
| updated_args = args[:-1] + (None, args[-1],) | ||
| return _fill_function_internal(*updated_args) | ||
| else: | ||
| return _fill_function_internal(*args) |
There was a problem hiding this comment.
You don't even need the else here:
iflen(args) ==5:
# [...]return_fill_function_internal(*updated_args)
return_fill_function_internal(*args)😊
rgbkrk
commented
Nov 2, 2017
I currently agree with merging this as is, with the caveat that we should remove the workaround at some point in the future. |
rgbkrk
commented
Nov 2, 2017
Whoops, accidentally closed and reopened, retriggering Travis. |
ogrisel
commented
Nov 8, 2017
Ok merging this as it to release 0.4.2. |
ogrisel
commented
Nov 8, 2017
Hum I had not read @pitrou's comment in #128 (comment). I will try to address it now. |
Peque
commented
Nov 8, 2017
@ogrisel Maybe an issue should be opened to revert this fix in future versions? |
HyukjinKwon
commented
Jan 29, 2018
Thank you guys for fixing this .. |
## What changes were proposed in this pull request? The version of cloudpickle in PySpark was close to version 0.4.0 with some additional backported fixes and some minor additions for Spark related things. This update removes Spark related changes and matches cloudpickle [v0.4.3](https://github.com/cloudpipe/cloudpickle/releases/tag/v0.4.3): Changes by updating to 0.4.3 include: * Fix pickling of named tuples cloudpipe/cloudpickle#113 * Built in type constructors for PyPy compatibility [here](cloudpipe/cloudpickle@d84980c) * Fix memoryview support cloudpipe/cloudpickle#122 * Improved compatibility with other cloudpickle versions cloudpipe/cloudpickle#128 * Several cleanups cloudpipe/cloudpickle#121 and [here](cloudpipe/cloudpickle@c91aaf1) * [MRG] Regression on pickling classes from the __main__ module cloudpipe/cloudpickle#149 * BUG: Handle instance methods of builtin types cloudpipe/cloudpickle#154 * Fix <span>#</span>129 : do not silence RuntimeError in dump() cloudpipe/cloudpickle#153 ## How was this patch tested? Existing pyspark.tests using python 2.7.14, 3.5.2, 3.6.3 Author: Bryan Cutler <cutlerb@gmail.com> Closesapache#20373 from BryanCutler/pyspark-update-cloudpickle-42-SPARK-23159.
Release 0.4.1 introduced a change to arguments of _fill_function
which meant that functions pickled before that couldn't be
unpickled anymore.
Addresses #126