Re: Is pickling of generator still supported in 3.3?
Christian Tismer <[email protected]> Fri, 26 Sep 2014 20:43:09 +0200
| Newsgroups | gmane.comp.python.stackless |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============7049099773130004732== Content-Type: multipart/alternative; boundary="------------080707000903080306040704" This is a multi-part message in MIME format. --------------080707000903080306040704 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Wen, On 09.09.14 18:58, Wen Tao wrote: > I was able to pickle a generator in the stackless python 2.7 version, > the code I use is: > > def process(): > yield 0 > yield 1 > > gen = process() > print(gen.send(None)) > import pickle > print(pickle.dumps(gen)) > > But in the stackless python 3.3 version (which I downloaded source > code and compiled in a Ubuntu 12.04 amd64 box), the code can not run. > The error message read was: > > 0 > Traceback (most recent call last): > File "test.py", line 8, in <module> > print(pickle.dumps(gen)) > _pickle.PicklingError: Can't pickle <class 'generator'>: attribute > lookup builtins.generator failed > > Is this a feature? Or deserve a bug fix? > This does of course deserve a bug fix. Looking into that ... cheers - Chris -- Christian Tismer :^) [email protected] Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : http://www.pydica.net/ 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 --------------080707000903080306040704 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <div class="moz-cite-prefix">Hi Wen,<br> <br> On 09.09.14 18:58, Wen Tao wrote:<br> </div> <blockquote cite="mid:CALgWZBrbkAbtWAJOuh=h4bWnfyQi680tOzT36+w67GyTqzMM9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org" type="cite"> <div dir="ltr">I was able to pickle a generator in the stackless python 2.7 version, the code I use is: <div><br> </div> <div> <div>def process():</div> <div><span class="" style="white-space:pre"> </span>yield 0</div> <div><span class="" style="white-space:pre"> </span>yield 1</div> <div><br> </div> <div>gen = process()</div> <div>print(gen.send(None))</div> <div>import pickle</div> <div>print(pickle.dumps(gen))</div> </div> <div><br> </div> <div>But in the stackless python 3.3 version (which I downloaded source code and compiled in a Ubuntu 12.04 amd64 box), the code can not run. The error message read was:</div> <div><br> </div> <div> <div>0</div> <div>Traceback (most recent call last):</div> <div> File "test.py", line 8, in <module></div> <div> print(pickle.dumps(gen))</div> <div>_pickle.PicklingError: Can't pickle <class 'generator'>: attribute lookup builtins.generator failed</div> </div> <div><br> </div> <div>Is this a feature? Or deserve a bug fix?</div> </div> <br> </blockquote> <br> This does of course deserve a bug fix.<br> Looking into that ...<br> <br> cheers - Chris<br> <pre class="moz-signature" cols="72">-- Christian Tismer :^) <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> Software Consulting : <a class="moz-txt-link-freetext" href="http://www.stackless.com/">http://www.stackless.com/</a> Karl-Liebknecht-Str. 121 : <a class="moz-txt-link-freetext" href="http://www.pydica.net/">http://www.pydica.net/</a> 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023 </pre> </body> </html> --------------080707000903080306040704-- --===============7049099773130004732== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Stackless mailing list [email protected] http://www.stackless.com/mailman/listinfo/stackless --===============7049099773130004732==--