This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients barry, eli.bendersky, ethan.furman, serhiy.storchaka
Date 2015-03-15.15:10:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426432245.83.0.265780672947.issue23673@psf.upfronthosting.co.za>
In-reply-to
Content
IntEnum is advertised as being a drop-in replacement for integer contants; however this fails in the case of unpickling on previous Python versions.

This occurs because when a pickle is created the module, class, and value are stored -- but those don't exist prior to Python 3.4.

One solution is to modify IntEnum to pickle just like a plain int would, but this has the serious disadvantage of losing the benefits of IntEnum on Python versions that support it.

Another solution is to use Serhiy's idea of pickling by name; this would store the module and name to look up in that madule, and this works on all Python versions that have that constant: on Python 3.3 socket.AF_INET returns an integerer (2, I think), and on Python 3.4+ it returns the AF_INET AddressFamily member.
History
Date User Action Args
2015-03-15 15:10:45ethan.furmansetrecipients: + ethan.furman, barry, eli.bendersky, serhiy.storchaka
2015-03-15 15:10:45ethan.furmansetmessageid: <1426432245.83.0.265780672947.issue23673@psf.upfronthosting.co.za>
2015-03-15 15:10:45ethan.furmanlinkissue23673 messages
2015-03-15 15:10:45ethan.furmancreate