You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sage: save(FreeGroup(1)/[], 'ab')
sage: load('ab.sobj')
Finitely presented group < x | >
sage: from sage.groups.finitely_presented import wrap_FpGroup
sage: save(wrap_FpGroup(libgap(FreeGroup(1)/[])), 'ab')
sage: load('ab.sobj')
---------------------------------------------------------------------------
GAPError Traceback (most recent call last)
Cell In[20], line 1
----> 1 load('ab.sobj')
File /usr/local/sage-310/src/sage/misc/persist.pyx:189, in sage.misc.persist.load()
187
188 ## Load file by absolute filename
--> 189 with open(filename, 'rb') as fobj:
190 X = loads(fobj.read(), compress=compress, **kwargs)
191 try:
File /usr/local/sage-310/src/sage/misc/persist.pyx:190, in sage.misc.persist.load()
188 ## Load file by absolute filename
189 with open(filename, 'rb') as fobj:
--> 190 X = loads(fobj.read(), compress=compress, **kwargs)
191 try:
192 X._default_filename = os.path.abspath(filename)
File /usr/local/sage-310/src/sage/misc/persist.pyx:995, in sage.misc.persist.loads()
993 unpickler = SageUnpickler(io.BytesIO(s), **kwargs)
994 global already_unpickled
--> 995 ans = unpickler.load()
996 already_unpickled = { }
997 return ans
File /usr/local/sage-310/src/sage/libs/gap/element.pyx:390, in sage.libs.gap.element._from_sage()
388
389
--> 390 cpdef _from_sage(elem) noexcept:
391 """
392 Currently just used for unpickling; equivalent to calling ``libgap(elem)``
File /usr/local/sage-310/src/sage/libs/gap/element.pyx:396, in sage.libs.gap.element._from_sage()
394 """
395 if isinstance(elem, str):
--> 396 return libgap.eval(elem)
397
398 return libgap(elem)
File /usr/local/sage-310/src/sage/libs/gap/libgap.pyx:406, in sage.libs.gap.libgap.Gap.eval()
404
405 initialize()
--> 406 elem = make_any_gap_element(self, gap_eval(gap_command))
407
408 # If the element is NULL just return None instead
File /usr/local/sage-310/src/sage/libs/gap/util.pyx:364, in sage.libs.gap.util.gap_eval()
362 try:
363 GAP_Enter()
--> 364 result = GAP_EvalString(cmd)
365 # We can assume that the result object is a GAP PList (plain list)
366 # and we should use functions for PLists directly for now; see
GAPError: Error, Variable: 'x' must have a value
Expected Behavior
It should be possible to save and load any finitely presented group. It is possible if it is created directly.
Actual Behavior
If the group comes from wrap_FpGroup a libgap group, the above error happens.
Additional Information
No response
Environment
-**Fedora 39**:
-**Sage Version*: 10.2*:
Checklist
I have searched the existing issues for a bug report that matches the one I want to file, without success.
I have read the documentation and troubleshoot guide
The text was updated successfully, but these errors were encountered:
I got a way for the following feature: if G is a libgap group and G1 = G.sage(), then G and G1.gap() coincide. Likely it is not optimal and instead of changing this branch I created a fake PR enriqueartal#8 to track the changed files.
I created reduce methods for several classes.
… libgap groups
<!-- Describe your changes here in detail -->
At this point it is not possible to load a saved finitely presented
group that comes from a libgap group, see an example in
sagemath#37061
One possible cause is the use of a general `__reduce__` method for free
groups. At least, adding such a method allows to load free groups or
finitely presented groups obtained from a libgap group using
`wrapFreeGroup` or `wrapFpGroup`. It fixessagemath#37061 and it would simplify
some code in sagemath#36768
With these changes, free and finitely presented groups, included libgap
groups, can be pickled.
### 📝 Checklist
- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [X] I have created tests covering the changes.
- [X] I have updated the documentation accordingly.
URL: sagemath#37128
Reported by: Enrique Manuel Artal Bartolo
Reviewer(s): Enrique Manuel Artal Bartolo, Travis Scrimshaw
Steps To Reproduce
Run the following code:
Expected Behavior
It should be possible to save and load any finitely presented group. It is possible if it is created directly.
Actual Behavior
If the group comes from
wrap_FpGroup
a libgap group, the above error happens.Additional Information
No response
Environment
Checklist
The text was updated successfully, but these errors were encountered: