<p dir="ltr"><br>
On 15 May 2013 07:38, "Guido van Rossum" <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
><br>
> On Tue, May 14, 2013 at 2:13 PM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>
> > On 05/14/2013 01:58 PM, Guido van Rossum wrote:<br>
> >><br>
> >> On Tue, May 14, 2013 at 1:09 PM, Ethan Furman <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br>
> >>> I can get pickle failure on members created using the functional syntax<br>
> >>> with no module set;<br>
> >><br>
> >><br>
> >> That's the case I care most about.<br>
> ><br>
> ><br>
> > Good, 'cause that one is handled.  :)<br>
><br>
> Then we're good.<br>
><br>
> >>> I cannot get pickle failure on those same classes;<br>
> >><br>
> >><br>
> >> I suppose you mean "if you create the same enums using class syntax"?<br>
> >> Sounds fine to me.<br>
> ><br>
> ><br>
> > No.  Example class:<br>
> ><br>
> > --> Example = Enum('Example', 'example ie eg')  # no module name given,<br>
> > frame hack fails<br>
> ><br>
> > --> pickle(Example.ie)<br>
> > # blows up<br>
> ><br>
> > --# pickle(Example)<br>
> > # succeeds here, but unpickle will fail<br>
><br>
> Not great, but (a) few people pickle classes, and (b) there's probably<br>
> something you can do to the metaclass to sabotage this. But it's fine<br>
> to punt on this now.</p>
<p dir="ltr">It may be a bug in pickle - it sounds like it is sanity checking type(obj), but not checking for cases where obj itself is a class.</p>
<p dir="ltr">Cheers,<br>
Nick.</p>
<p dir="ltr">><br>
> >>> I cannot get pickle failure on class syntax enums that inherit complex<br>
> >>> types<br>
> >>> (such as the NEI class in the tests).<br>
> >><br>
> >><br>
> >> Is the NEI base class picklable?<br>
> ><br>
> ><br>
> > No.  If it is, then the derived enum is also picklable (at least the<br>
> > variation I have tested, which is when the NEI base class has<br>
> > __getnewargs__).<br>
> ><br>
> > I'm really hoping you'll say that can be a documentation issue.  ;)<br>
><br>
> Essentially the same response -- with enough hackery you can probably<br>
> get this to do what you want, but I wouldn't hold up a release for it.<br>
><br>
> For example you could file low-priority bugs for both issues in the<br>
> hope that someone else figures it out.<br>
><br>
> --<br>
> --Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)<br>
> _______________________________________________<br>
> Python-Dev mailing list<br>
> <a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/python-dev">http://mail.python.org/mailman/listinfo/python-dev</a><br>
> Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com">http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com</a><br>
</p>