Skip to content
Closed
Prev Previous commit
Next Next commit
Save and restore the module info functions
  • Loading branch information
holdenk committed Jul 25, 2017
commit 09cf41eb3e75e92cc9914e675fb2cb2f99290d38
4 changes: 3 additions & 1 deletion python/pyspark/cloudpickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ def save_function_tuple(self, func):
save(f_globals)
save(defaults)
save(dct)
save(func.__module__)
save(closure_values)
write(pickle.TUPLE)
write(pickle.REDUCE) # applies _fill_function on the tuple
Expand Down Expand Up @@ -1007,13 +1008,14 @@ def __reduce__(cls):
return cls.__name__


def _fill_function(func, globals, defaults, dict, closure_values):
def _fill_function(func, globals, defaults, dict, module, closure_values):
""" Fills in the rest of function data into the skeleton function object
that were created via _make_skel_func().
"""
func.__globals__.update(globals)
func.__defaults__ = defaults
func.__dict__ = dict
func.__module__ = module

cells = func.__closure__
if cells is not None:
Expand Down