Skip to content
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

Add pickle support to ActionShortcut #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ryanwmoore
Copy link

On my setup (Mac), multiprocessing defaults to pickling + unpickling state from the main process to worker processes. Pickling doesn't/can't support local functions. Because ActionShortcut's getattr returns a local function regardless of the attribute name that's requested, instances of that class cannot be pickled without this fix.

The solution is to implement a custom getstate and setstate, to state how ActionShortcut should be pickled/unpickled.

Includes a basic test.

https://docs.python.org/3/library/pickle.html#object.__getstate__
https://docs.python.org/3/library/multiprocessing.html

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.

1 participant