STINNER Victor <[email protected]> added the comment:
> 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!
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43228>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com