TODO
|
|
| ☐ |
Use sig_occurred() to check whether an exception from Cysignals is currently being handled while in Integer.tp_dealloc. If so, assume that the state of the object's mpz struct may not be consistent, so do not call mpz_clear on it and do not place it back in the free pool. |
| ☐ |
Don't forget to re-enable the test that was disabled in #25137 in order to test that this is fixed. |
As discussed on sage-devel, I'm fairly consistently (roughly 9 times out of 10) getting the following failure on Cygwin:
sage -t --warn-long 164.8 src/sage/structure/coerce_actions.pyx
**********************************************************************
File "src/sage/structure/coerce_actions.pyx", line 786, in
sage.structure.coerce_actions.IntegerMulAction._repr_name_
Failed example:
IntegerMulAction(ZZ, GF5)
Expected:
Left Integer Multiplication by Integer Ring on Finite Field of size 5
Got:
Left Integer Multiplication by Integer Ring on Finite Field of size 1
**********************************************************************
1 item had failures:
1 of 4 in sage.structure.coerce_actions.IntegerMulAction._repr_name_
[143 tests, 1 failure, 3.30 s]
----------------------------------------------------------------------
sage -t --warn-long 164.8 src/sage/structure/coerce_actions.pyx # 1
doctest failed
Obviously Sage doesn't even allow creation of an order 1 field. In fact, I traced the cause of this to a specific line in FiniteFieldFactory.create_key_and_extra_args where, by chance, an Integer with a value of 1 is constructed (using fast_tp_new) whose (mp_limb*)(Integer.value._mp_d) member is assigned the same address as the _mp_d of the Integer that happens to hold the field's order.
The result is that the order is then set to 1 as well. This happens after the check that order>1 so creation of the field still succeeds. Clearly there is a subtle bug either in fast_tp_new, or in the memory allocator itself.
Depends on #27073
CC: @jdemeyer @xcaruso
Component: cython
Author: Jeroen Demeyer
Branch/Commit: 521bac9
Reviewer: Erik Bray
Issue created by migration from https://trac.sagemath.org/ticket/24986
TODO
sig_occurred()to check whether an exception from Cysignals is currently being handled while inInteger.tp_dealloc. If so, assume that the state of the object's mpz struct may not be consistent, so do not callmpz_clearon it and do not place it back in the free pool.As discussed on sage-devel, I'm fairly consistently (roughly 9 times out of 10) getting the following failure on Cygwin:
Obviously Sage doesn't even allow creation of an order 1 field. In fact, I traced the cause of this to a specific line in
FiniteFieldFactory.create_key_and_extra_argswhere, by chance, anIntegerwith a value of1is constructed (usingfast_tp_new) whose(mp_limb*)(Integer.value._mp_d)member is assigned the same address as the_mp_dof theIntegerthat happens to hold the field's order.The result is that the
orderis then set to1as well. This happens after the check thatorder>1so creation of the field still succeeds. Clearly there is a subtle bug either infast_tp_new, or in the memory allocator itself.Depends on #27073
CC: @jdemeyer @xcaruso
Component: cython
Author: Jeroen Demeyer
Branch/Commit:
521bac9Reviewer: Erik Bray
Issue created by migration from https://trac.sagemath.org/ticket/24986