Skip to content

Enums #101

Description

@mrocklin

This fails

importenumclassMyEnum(enum.Enum):
SPAM='SPAM'importcloudpicklecloudpickle.dumps(MyEnum.SPAM)
---------------------------------------------------------------------------RecursionErrorTraceback (mostrecentcalllast)
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyindump(self, obj)
145try:
-->146returnPickler.dump(self, obj)
147exceptRuntimeErrorase:
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyindump(self, obj)
408self.framer.start_framing()
-->409self.save(obj)
410self.write(STOP)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
520# Save the reduce() output and finally memoize the object-->521self.save_reduce(obj=obj, *rv)
522/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_reduce(self, func, args, state, listitems, dictitems, obj)
584else:
-->585save(func)
586save(args)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
489ifissc:
-->490self.save_global(obj)
491return/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_global(self, obj, name, pack)
424-->425self.save_reduce(typ, (obj.__name__, obj.__bases__, d), obj=obj)
426else:
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_reduce(self, func, args, state, listitems, dictitems, obj)
585save(func)
-->586save(args)
587write(pickle.REDUCE)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
475iffisnotNone:
-->476f(self, obj) # Call unbound method with explicit self477return/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave_tuple(self, obj)
735forelementinobj:
-->736save(element)
737# Subtle. Same as in the big comment below./home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
475iffisnotNone:
-->476f(self, obj) # Call unbound method with explicit self477return/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave_dict(self, obj)
820self.memoize(obj)
-->821self._batch_setitems(obj.items())
822/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyin_batch_setitems(self, items)
846save(k)
-->847save(v)
848write(SETITEMS)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
520# Save the reduce() output and finally memoize the object-->521self.save_reduce(obj=obj, *rv)
522/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_reduce(self, func, args, state, listitems, dictitems, obj)
600ifdictitemsisnotNone:
-->601self._batch_setitems(dictitems)
602/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyin_batch_setitems(self, items)
851save(k)
-->852save(v)
853write(SETITEM)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
520# Save the reduce() output and finally memoize the object-->521self.save_reduce(obj=obj, *rv)
522/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_reduce(self, func, args, state, listitems, dictitems, obj)
584else:
-->585save(func)
586save(args)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
489ifissc:
-->490self.save_global(obj)
491return/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_global(self, obj, name, pack)
424-->425self.save_reduce(typ, (obj.__name__, obj.__bases__, d), obj=obj)
426else:
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_reduce(self, func, args, state, listitems, dictitems, obj)
585save(func)
-->586save(args)
587write(pickle.REDUCE)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
475iffisnotNone:
-->476f(self, obj) # Call unbound method with explicit self477return/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave_tuple(self, obj)
735forelementinobj:
-->736save(element)
737# Subtle. Same as in the big comment below./home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
475iffisnotNone:
-->476f(self, obj) # Call unbound method with explicit self477return/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave_dict(self, obj)
820self.memoize(obj)
-->821self._batch_setitems(obj.items())
822/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyin_batch_setitems(self, items)
846save(k)
-->847save(v)
848write(SETITEMS)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
475iffisnotNone:
-->476f(self, obj) # Call unbound method with explicit self477return/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave_dict(self, obj)
820self.memoize(obj)
-->821self._batch_setitems(obj.items())
822/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyin_batch_setitems(self, items)
851save(k)
-->852save(v)
853write(SETITEM)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
520# Save the reduce() output and finally memoize the object-->521self.save_reduce(obj=obj, *rv)
522/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_reduce(self, func, args, state, listitems, dictitems, obj)
584else:
-->585save(func)
586save(args)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
489ifissc:
-->490self.save_global(obj)
491return/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_global(self, obj, name, pack)
424-->425self.save_reduce(typ, (obj.__name__, obj.__bases__, d), obj=obj)
426else:
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyinsave_reduce(self, func, args, state, listitems, dictitems, obj)
585save(func)
-->586save(args)
587write(pickle.REDUCE)
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
475iffisnotNone:
-->476f(self, obj) # Call unbound method with explicit self477return/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave_tuple(self, obj)
735forelementinobj:
-->736save(element)
737# Subtle. Same as in the big comment below./home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
475iffisnotNone:
-->476f(self, obj) # Call unbound method with explicit self477return/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave_dict(self, obj)
820self.memoize(obj)
-->821self._batch_setitems(obj.items())
822/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyin_batch_setitems(self, items)
846save(k)
-->847save(v)
848write(SETITEMS)
... last10framesrepeated, fromtheframebelow ...
/home/mrocklin/Software/anaconda/lib/python3.6/pickle.pyinsave(self, obj, save_persistent_id)
520# Save the reduce() output and finally memoize the object-->521self.save_reduce(obj=obj, *rv)
522RecursionError: maximumrecursiondepthexceededDuringhandlingoftheaboveexception, anotherexceptionoccurred:
PicklingErrorTraceback (mostrecentcalllast)
<ipython-input-3-d64a2267ce31>in<module>()
---->1cloudpickle.dumps(MyEnum.SPAM)
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyindumps(obj, protocol)
704705cp=CloudPickler(file,protocol)
-->706cp.dump(obj)
707708returnfile.getvalue()
/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/cloudpickle/cloudpickle.pyindump(self, obj)
148if'recursion'ine.args[0]:
149msg="""Could not pickle object as excessively deep recursion required."""-->150raisepickle.PicklingError(msg)
151152defsave_memoryview(self, obj):
PicklingError: Couldnotpickleobjectasexcessivelydeeprecursionrequired.

Originally reported here: dask/distributed#1178 by @AndrewPashkin

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