Made a pull request...

https://github.com/sagemath/sage/pull/41620

On Tuesday, February 10, 2026 at 7:31:53 PM UTC+1 Michel VAN DEN BERGH 
wrote:

> On Monday, February 9, 2026 at 12:30:17 PM UTC+1 Michel VAN DEN BERGH 
> wrote:
>
> I have been playing with the code in sage/src/sage/libs/gap/element.pyx 
> and the errors we are seeing are very similar to those that occur when you 
> are not careful with wrapping things with GAP_Enter()/GAP_Leave().
>
> Could it be that executing W(w) (w being a GapElement_Permutation) calls 
> back into GAP somewhere and this is not properly bracketed?
>
> Best,
> Michel
>
>
> This seems to be what's going on. I exported GAP_Enter and GAP_Leave to 
> python functions by adding the following code to
> src/sage/libs/gap/element.pyx
>
> def GAP_Start():
>   GAP_Enter()
>
> def GAP_Stop():
>   GAP_Leave() 
>
> Then I can import these in the test script
>
> from sage.libs.gap.element import GAP_Start, GAP_Stop
>
> If I then wrap W(w) using GAP_Start(), GAP_Stop() while iterating the 
> issue seems to have been solved.
>
> Best,
> Michel
>
>
>
>
>
>
>
>
> On Sunday, February 8, 2026 at 9:33:35 AM UTC+1 Michel VAN DEN BERGH wrote:
>
> On Saturday, February 7, 2026 at 10:53:27 PM UTC+1 wrote:
>
> I find Sage's permutation groups a bit weird.
> Old GAP interface was slow, so there were some Cython classes written, and 
> then libgap came along...
>
> Can you do your computations in "pure" libgap groups? 
>
>
> Probably. But then I couldn't benefit from the stuff in Sage implemented 
> for Weyl groups. I would have to learn the GAP equivalents.
> That's probably not too hard, but since there is a workaround for the bug 
> (albeit an inconvenient one for large groups) I think I'll stick with that.
>
> Best,
> Michel
>
>  
>
> I.e. convert W into libgap(W), then these conversions from libgap 
> permutations to W's permutations aren't even necessary.
>
> I am aware of one potentially serious libgap interface bug, which might be 
> playing up here - calls to libgap functions, which pass handles to GAP 
> objects, might get optimised by the compiler, and break things, unless they 
> are declared volatile.
> And the latter is only done in few places so far - see e.g. sage issue 
> #37026
>
> Dima
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-support/7b54bee0-249a-4b36-9672-b2cac3a02213n%40googlegroups.com.

Reply via email to