id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
24986,Inconsistent mpz_t state after interrupted sig_realloc(),embray,,"=== 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.",defect,closed,major,sage-8.7,cython,fixed,cygwin,jdemeyer caruso,,Jeroen Demeyer,Erik Bray,N/A,,521bac96289ae33b5ecf337f1f36a7fd29d7bc8a,521bac96289ae33b5ecf337f1f36a7fd29d7bc8a,#27073,