Skip to content

Failure on unhashable functions in Python 2 #144

Description

@mrocklin

This showed up in Dask's test suite after the recent release. Python 2 only.

In [1]: d= {'a': 1}
In [2]: importcloudpickleIn [3]: cloudpickle.dumps(d.get)
---------------------------------------------------------------------------TypeErrorTraceback (mostrecentcalllast)
<ipython-input-3-8adaadeed8cc>in<module>()
---->1cloudpickle.dumps(d.get)
/home/mrocklin/Software/anaconda/envs/27/lib/python2.7/site-packages/cloudpickle/cloudpickle.pycindumps(obj, protocol)
844try:
845cp=CloudPickler(file,protocol)
-->846cp.dump(obj)
847returnfile.getvalue()
848finally:
/home/mrocklin/Software/anaconda/envs/27/lib/python2.7/site-packages/cloudpickle/cloudpickle.pycindump(self, obj)
258self.inject_addons()
259try:
-->260returnPickler.dump(self, obj)
261exceptRuntimeErrorase:
262if'recursion'ine.args[0]:
/home/mrocklin/Software/anaconda/envs/27/lib/python2.7/pickle.pycindump(self, obj)
222ifself.proto>=2:
223self.write(PROTO+chr(self.proto))
-->224self.save(obj)
225self.write(STOP)
226/home/mrocklin/Software/anaconda/envs/27/lib/python2.7/pickle.pycinsave(self, obj)
284f=self.dispatch.get(t)
285iff:
-->286f(self, obj) # Call unbound method with explicit self287return288/home/mrocklin/Software/anaconda/envs/27/lib/python2.7/site-packages/cloudpickle/cloudpickle.pycinsave_builtin_function(self, obj)
611ifobj.__module__=="__builtin__":
612returnself.save_global(obj)
-->613returnself.save_function(obj)
614dispatch[types.BuiltinFunctionType] =save_builtin_function615/home/mrocklin/Software/anaconda/envs/27/lib/python2.7/site-packages/cloudpickle/cloudpickle.pycinsave_function(self, obj, name)
330interactiveprompt, etc) andhandlesthepicklingappropriately.
331 """
-->332ifobjin_BUILTIN_TYPE_CONSTRUCTORS:
333# We keep a special-cased cache of built-in type constructors at334# global scope, because these functions are structured veryTypeError: unhashabletype: 'dict'

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