Ethan Furman added the comment: Serhiy commented: ----------------- > Actually they don't pickle due to wrong __module__. After adding > > NEI.__module__ = NamedInt.__module__ = __name__ > > PicklingError no longer raised for enum class.
If you were to look at the `_make_class_unpicklable` function you would see it works by setting __module__ to <unknown>. So, in fact, it does not pickle precisely because it has the wrong module, and your change undoes what Enum was tryng to do: if an instance cannot be pickled, don't let the class be pickled either. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20534> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com