-
Notifications
You must be signed in to change notification settings - Fork 159
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
Allow pickling simple instances of caches. #40
Conversation
This is not particularly robust, but it handles (and tests) the simplest examples. In general, pickle does not handle lambda functions, so this is about the best that can be done. It's worth noting that this uses a non-default pickle protocol: the regular one fails due to __slots__ with no __getstate__ implementation. This non-default protocol is specified with dumps(cache, -1): the -1 means "latest". For a more robust pickling solution, try the dill module.
Thanks, I wasn't aware of that, since I never used |
Please correct me if I'm wrong, but AFAICS, for the |
As for pickling the |
@ncalexan: you still there? |
@tkmem: thanks for pushing this over the line. On Thu, Jun 18, 2015 at 10:27 AM, Thomas Kemmer notifications@github.com
|
You're welcome ;-) Hope you don't mind that I didn't use your initial implementation, but this matched some refactorings regarding |
On Thu, Jun 18, 2015 at 11:46 AM, Thomas Kemmer notifications@github.com
|
This is not particularly robust, but it handles (and tests) the simplest
examples. In general, pickle does not handle lambda functions, so this
is about the best that can be done. It's worth noting that this uses
a non-default pickle protocol: the regular one fails due to slots
with no getstate implementation. This non-default protocol is
specified with dumps(cache, -1): the -1 means "latest".
For a more robust pickling solution, try the dill module.