This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Mark.Shannon, frenzy, pablogsal, vstinner
Date 2021-02-18.11:32:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613647978.26.0.583464115137.issue43228@roundup.psfhosted.org>
In-reply-to
Content
> but __builtins__.__dict__ cannot be pickled.

I don't see why cloudpickle calls LambdaType() directly. It could use a helper in their cloudpickle.cloudpickle_fast which calls LambdaType() with the proper arguments, especially to get __builtins__. I don't think that cloudpickle should serialize __builtins__!

By the way, I'm not sure why the function constructor builds {'None': None} namespace for builtins rather than inheriting the current builtins namespace. IMO it's unconvenient.

If someone wants to override __builtins__, setting __builtins__ key in the globals namespace should be enough.

> Adding a "builtins" parameter to types.FunctionType() should be be enough.

Oh right, we should give the ability to control this important parameter!
History
Date User Action Args
2021-02-18 11:32:58vstinnersetrecipients: + vstinner, Mark.Shannon, frenzy, pablogsal
2021-02-18 11:32:58vstinnersetmessageid: <1613647978.26.0.583464115137.issue43228@roundup.psfhosted.org>
2021-02-18 11:32:58vstinnerlinkissue43228 messages
2021-02-18 11:32:58vstinnercreate