Skip to content

Fix unpickling a curried function defined in __main__ - #645

Open
Cherith1222 wants to merge 1 commit into
pytoolz:masterfrom
Cherith1222:fix/606-curry-main-pickle
Open

Cherith1222 wants to merge 1 commit into
pytoolz:masterfrom
Cherith1222:fix/606-curry-main-pickle

Conversation

@Cherith1222

Copy link
Copy Markdown

This patch was drafted with assistance from Cursor. The account owner confirmed it could be sent after the Factory checks (repository policy, no covering pull request, and a local test that failed first and then passed).

A curry defined in __main__ is stored by cloudpickle as __main__:f. A new process then raises AttributeError because that name is not on the fresh __main__ module. curry.__reduce__ now keeps the function object when the module name is __main__.

Fixes #606

cloudpickle stored a __main__ name, so a fresh process could not find the function. When the module name is __main__, curry.__reduce__ keeps the function object.

AI-assisted (Cursor). The account owner confirmed this can be sent after the Factory checks.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can't unpickle curryied function coming from __main__

1 participant