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

Allow serialization of Galois field #388

Closed
raeudigerRaeffi opened this issue Jul 26, 2022 · 4 comments · Fixed by #393
Closed

Allow serialization of Galois field #388

raeudigerRaeffi opened this issue Jul 26, 2022 · 4 comments · Fixed by #393
Labels
bug Something isn't working

Comments

@raeudigerRaeffi
Copy link

I recently tried playing around with multithreading and noticed, that I can not pass the Galois field object to a thread, since the Galois class can not be pickled. An example error would be
PicklingError: Can't pickle <class 'galois.GF(47)'>: attribute lookup GF(47) on galois failed

@raeudigerRaeffi
Copy link
Author

would probably be a feature request

@mhostetter mhostetter added the feature-request New feature or request label Jul 26, 2022
@mhostetter
Copy link
Owner

I don't believe I've made a class pickleable before, but it seems possible. I think maybe adding __get_state__() and __set_state__() to FieldArrayMeta will do the trick. I'll look into it and play around.

https://docs.python.org/3/library/pickle.html#pickling-class-instances

@mhostetter mhostetter added bug Something isn't working and removed feature-request New feature or request labels Jul 26, 2022
@mhostetter
Copy link
Owner

@raeudigerRaeffi I believe I resolved this in #393. Can you test it on your side?

You can install that branch like this.

$ python3 -m pip uninstall galois
$ python3 -m pip install git+https://github.com/mhostetter/galois@support-pickle

@mhostetter
Copy link
Owner

@raeudigerRaeffi this should be resolved. Feel free to re-open or open a new issue if you continue to have problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants