Skip to content

make cloudpickle and cloudpickle_fast use the same reducers. #284

Description

@pierreglaser

cloudpickle and cloudpickle_fast differ in the sense that the cloudpickle_fast's CloudPickler only has to reduce objects (the actual saving is taken care of by logic coded in the pickle.Pickler class), whereas the cloudpickle.CloudPickler reduces AND saves objects in one single method (save_{object_type}(self, obj))

Right now, the cloudpickle.CloudPickler reducing parts of the save_{object_type} methods do not use the reduce_{object_type} reducers implemented in cloudpickle_fast.
To avoid the need to write twice any change we make to a reducer, it would be great to refactor most cloudpickle.CloudPickler.save_* methods, to make them look like this

defsave_{object_type}(self, obj):
rv=reduce_{object_type}(obj)
self.save_reduce(*rv, obj=obj)

reduce_{object_type} being used both by cloudpickle and cloudpickle_fast.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions