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

pickling to strings? #75

Open
dimpase opened this issue Dec 27, 2018 · 8 comments
Open

pickling to strings? #75

dimpase opened this issue Dec 27, 2018 · 8 comments

Comments

@dimpase
Copy link
Member

dimpase commented Dec 27, 2018

Sometimes it is better to have a pickle to a string, or to a memory area, e.g. in libgap setting, where GAP objects might be parts of a bigger structure that needs to be pickled, e.g. a Python one, cf https://docs.python.org/2/library/pickle.html

I imagine it should not be too hard to provide, as the existing in IO code surely has all the needed parts available, but is these a chance such a change is accepted and merged?

@olexandr-konovalov
Copy link
Member

@dimpase I have IO_PickleToString and IO_UnpickleFromString (see https://gap-packages.github.io/scscp/doc/chap9.html#X84F055ED860120D5). Historically this appeared in SCSCP to satisfy its needs, and I am happy to submit a PR and move them to IO.

@dimpase
Copy link
Member Author

dimpase commented Jan 3, 2019

This looks like a reasonable thing to do, thanks in advance!

@fingolfin
Copy link
Member

PRs welcome :-)

@ChrisJefferson
Copy link
Member

ChrisJefferson commented Dec 8, 2020

Stupid question, isn't what you want already there (this doesn't let you specify a memory block (edit: was group)). This has been there since 2011.

gap> s := IO_Pickle(Group((1,2,3)));
"PRMGILIS\>1PERM\>7(1,2,3)FAILFAIL"
gap> IO_Unpickle(s);
Group([ (1,2,3) ])

@ChrisJefferson
Copy link
Member

Quickly checking, I notice this isn't documented, so that's a problem :)

@dimpase
Copy link
Member Author

dimpase commented Dec 8, 2020

Document it, or it doesn't exist! :-)

And so we'd be busily picking GAP groups.

I don't understand what do you mean by saying that it doesn't let you specify a group.

@ChrisJefferson
Copy link
Member

I meant existing memory block, which you mentioned, obviously had groups on the brain.

@ChrisJefferson
Copy link
Member

Just in case you hit it, if you pickle permutation groups which are the results of GAP computations you might hit #91 ( which was just found by me, and fixed, a few days ago). This will only be a problem if you pickle the identity group, and only then the identity group returned by some GAP methods.

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

No branches or pull requests

4 participants