[C++-sig] Pickle an enum from c++
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Tue Dec 9 17:02:36 CET 2008
Indeed (I had forgotten this already...):
------------------------------------------------------------------------
r36256 | rwgk | 2006-12-03 12:43:48 -0800 (Sun, 03 Dec 2006) | 2 lines
fixes to support pickling of enums (by Shashank Bapat)
------------------------------------------------------------------------
And there is this test (boost/libs/python/test/enum.py):
# pickling of enums only works with Python 2.3 or higher
exercise_pickling = '''
>>> import pickle
>>> p = pickle.dumps(color.green, pickle.HIGHEST_PROTOCOL)
>>> l = pickle.loads(p)
>>> identity(l)
enum_ext.color.green
'''
So this is supposed to work.
----- Original Message ----
From: Hans Meine <meine at informatik.uni-hamburg.de>
To: Development of Python/C++ integration <cplusplus-sig at python.org>
Cc: Ralf W. Grosse-Kunstleve <rwgk at yahoo.com>
Sent: Tuesday, December 9, 2008 4:40:17 AM
Subject: Re: [C++-sig] Pickle an enum from c++
On Monday 08 December 2008 20:02:41 Roman Yakovenko wrote:
> 2008/12/8 Matthew Scouten (TT) <Matthew.Scouten at tradingtechnologies.com>:
> > From the lack of response I assume that no one has any clever ideas to
> > make an enum pickleable. Thank you to anyone who put thought into this.
> >
> :-).
>
> I thought about work around: you can define your enums in Python. May
> be youcan add this functionality from Python?
>
> Also did you see the following discussion?
> http://mail.python.org/pipermail/cplusplus-sig/2006-November/011372.html
Oh, this is continued here:
http://mail.python.org/pipermail/cplusplus-sig/2006-November/011376.html
Looks like there was a solution in 2006; Ralf even wanted to have a test case
for check-in. Ralf, did you receive stuff from Shashank back then? (Or did
you wait until today with committing the fix?)
Greetings,
Hans
More information about the Cplusplus-sig
mailing list