[ python-Feature Requests-1092962 ] Make Generators Pickle-able

SourceForge.net noreply at sourceforge.net
Thu Dec 30 15:16:07 CET 2004


Feature Requests item #1092962, was opened at 2004-12-29 22:52
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1092962&group_id=5470

>Category: Python Library
>Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jayson Vantuyl (jaysonvantuyl)
Assigned to: Nobody/Anonymous (nobody)
Summary: Make Generators Pickle-able

Initial Comment:
Would it be possible to make generators pickle-able?  I
mean, currently the internal state is saved in some
way.  Would it be possible to make pickle handle them?

Put another way, if generators had a __getnewargs__
function that returned some data (say a tuple of module
name, function name, locals/globals dicts and some code
dependent location data) and then allow:

  generator.__new__(statedata)

to reconstruct it (or something more elegant).

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2004-12-30 15:16

Message:
Logged In: YES 
user_id=21627

Moving into the feature requests tracker.

I don't think this is possible (or should be done if it were
possible). Pickle has traditionally abstained from pickling
functions, so IMO it should not picke generators, either. If
this was enabled by default, it would open up yet another
security hole.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1092962&group_id=5470


More information about the Python-bugs-list mailing list