[pypy-dev] Pickling generators

Carl Friedrich Bolz-Tereick cfbolz at gmx.de
Fri Dec 11 16:16:55 EST 2020


Hi Steven, hi all,

I don't think it's a huge intentional thing that we don't support this
feature in PyPy3. It's mostly that nobody was motivated enough to
implement it (as Armin said in the linked issue). So if somebody wants
to tackle it, we'd be happy to merge it!

Cheers,

CF

On 11.12.20 21:49, Steven D'Aprano wrote:
> On Fri, Dec 11, 2020 at 03:21:18PM +0200, Matti Picus wrote:
>> According to issue 3150
>> https://foss.heptapod.net/pypy/pypy/-/issues/3150, this is on purpose,
>> and brings us into feature compatibility with CPython:
>
> The inability to pickle an object is not a feature, it is the lack of a
> feature. I think this is a case where PyPy initially did the right thing
> and then threw it away.
>
> I'm not satisfied by the arguments given here:
>
> http://peadrop.com/blog/2009/12/29/why-you-cannot-pickle-generators/
>
> https://bugs.python.org/issue1092962
>
> for CPython to not pickle generators, but pickling generators is not
> forbidden by the language, it is a quality of implementation issue. In
> this instance, both Stackless and PyPy 2 had better implementations than
> CPython.
>
>
>> I guess we could improve the error message to be more helpful. Do you
>> have a concrete use case for this?
>
> You have a generator which you are iterating through, and you want to
> stop your program and resume later. Or resume immediately but from
> another process.
>
>



More information about the pypy-dev mailing list