Is pickling of generator still supported in 3.3?

Wen Tao <[email protected]> Wed, 10 Sep 2014 00:58:11 +0800
Newsgroups gmane.comp.python.stackless
Message-ID <CALgWZBrbkAbtWAJOuh=h4bWnfyQi680tOzT36+w67GyTqzMM9A@mail.gmail.com>
--===============0322670437455296778==
Content-Type: multipart/alternative; boundary=001a1135fa922a3b360502a4d757

--001a1135fa922a3b360502a4d757
Content-Type: text/plain; charset=UTF-8

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?

--001a1135fa922a3b360502a4d757
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"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=3D"" style=3D"white-space:pre">	</span>yield 0</div><div><=
span class=3D"" style=3D"white-space:pre">	</span>yield 1</div><div><br></d=
iv><div>gen =3D process()</div><div>print(gen.send(None))</div><div>import =
pickle</div><div>print(pickle.dumps(gen))</div></div><div><br></div><div>Bu=
t in the stackless python 3.3 version (which I downloaded source code and c=
ompiled in a Ubuntu 12.04 amd64 box), the code can not run. The error messa=
ge read was:</div><div><br></div><div><div>0</div><div>Traceback (most rece=
nt call last):</div><div>=C2=A0 File &quot;test.py&quot;, line 8, in &lt;mo=
dule&gt;</div><div>=C2=A0 =C2=A0 print(pickle.dumps(gen))</div><div>_pickle=
.PicklingError: Can&#39;t pickle &lt;class &#39;generator&#39;&gt;: attribu=
te lookup builtins.generator failed</div></div><div><br></div><div>Is this =
a feature? Or deserve a bug fix?</div></div>

--001a1135fa922a3b360502a4d757--


--===============0322670437455296778==
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
--===============0322670437455296778==--