-
Notifications
You must be signed in to change notification settings - Fork 176
Compatibility with Python 3.10 #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not able to find the root cause. I have two functions:
There is a difference in theirs
Changing
|
It's a Python regression, I created https://bugs.python.org/issue43228 |
The problem is that cloudpickle calls LambaType to build a function with a globals dictionary which doesn't contain a cloudpickle should try to call LambdaType with a globals dictionary which contains a Currently, builtins are only overriden after the function is created, which is too late. In Python 3.10, it's currently not possible to modify the internal function builtins dictionary. But I proposed python/cpython#24559 to let cloudpickle also update this dictionary in its cloudpickle.cloudpicke_fast._function_setstate() function. |
Thanks for helping with this issue @vstinner. If I understood correctly, following python/cpython#24559, when a function is created using cloudpickle/cloudpickle/cloudpickle_fast.py Lines 428 to 448 in cdc704d
|
I just merged another PR which should fix cloudpickle (but I didn't test yet): I now plan to add an optional builtins parameter to FunctionType. |
This is what my previous comment was referring to.
This will be necessary to let users of |
This issue was a regression of Python 3.10: I fixed it in Python 3.10.0 alpha 6. This cloudpickle issue can now be closed. |
Just following up here, based on @vstinner's latest comment (xref #410 (comment)) and the Python 3.10-dev CI build passing on the main branch, it seems like this issue can be closed. cc @pierreglaser |
Thanks @jrbourbeau! |
Thanks for the confirmation! |
It seems to me that cloudpickle is not compatible with the latest Python 3.10a5. A short reproducer:
According to the following results from tests, there is a problem with builtins:
Some incompatibilities are already fixed in: #400
It would be nice to add Python 3.9 and 3.10 to CI.
The text was updated successfully, but these errors were encountered: