Call sig_block() in integral callback
Fix https://github.com/sagemath/sage/issues/30379 .
The implementation mimic acb_calc_func_callback.
also increase tolerance for a few parts, since the CI system is somewhat unreliable (I've seen a 2.00 being 2.04). I guess 0.1s is still considered almost imperceptible by human.
:memo: Checklist
- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation preview.
:hourglass: Dependencies
Documentation preview for this PR (built with commit b66d785e0f1d1bd5f01b9fb1b8dde2cace402584; changes) is ready! :tada: This preview will update shortly after each push to this PR.
Just got this:
src/bin/sage -t --warn-long 5.0 --random-seed=13341543192946447292488981102614601354 src/sage/doctest/util.py
**********************************************************************
Error: Failed example:: Got:
cysignals.signals.AlarmInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/forker.py", line 734, in _run
self.compile_and_execute(example, compiler, test.globs)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/forker.py", line 1158, in compile_and_execute
exec(compiled, globs)
~~~~^^^^^^^^^^^^^^^^^
File "<doctest sage.doctest.util.inaccuracy_tolerance[12]>", line 1, in <module>
with ensure_interruptible_after(Integer(1)): uninterruptible_sleep(2); raise RuntimeError
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/contextlib.py", line 162, in __exit__
self.gen.throw(value)
~~~~~~~~~~~~~~^^^^^^^
File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/util.py", line 897, in ensure_interruptible_after
raise RuntimeError(
f"Function is not interruptible within {seconds:.4f} seconds, only after {elapsed:.4f} seconds"
+ ("" if alarm_raised else " (__exit__ called before interrupt check)"))
RuntimeError: Function is not interruptible within 1.0000 seconds, only after 2.1566 seconds
with ensure_interruptible_after(1): uninterruptible_sleep(2r); raise RuntimeError
Expected:
Traceback (most recent call last):
...
RuntimeError: Function is not interruptible within 1.0000 seconds, only after 2.00... seconds
Got:
<BLANKLINE>
cysignals.signals.AlarmInterrupt
<BLANKLINE>
During handling of the above exception, another exception occurred:
<BLANKLINE>
Traceback (most recent call last):
File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/forker.py", line 734, in _run
self.compile_and_execute(example, compiler, test.globs)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/forker.py", line 1158, in compile_and_execute
exec(compiled, globs)
~~~~^^^^^^^^^^^^^^^^^
File "<doctest sage.doctest.util.inaccuracy_tolerance[12]>", line 1, in <module>
with ensure_interruptible_after(Integer(1)): uninterruptible_sleep(2); raise RuntimeError
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/contextlib.py", line 162, in __exit__
self.gen.throw(value)
~~~~~~~~~~~~~~^^^^^^^
File "/Users/runner/miniconda3/envs/sage-dev/lib/python3.13/site-packages/sage/doctest/util.py", line 897, in ensure_interruptible_after
raise RuntimeError(
f"Function is not interruptible within {seconds:.4f} seconds, only after {elapsed:.4f} seconds"
+ ("" if alarm_raised else " (__exit__ called before interrupt check)"))
RuntimeError: Function is not interruptible within 1.0000 seconds, only after 2.1566 seconds
**********************************************************************
1 item had failures:
1 of 17 in sage.doctest.util.inaccuracy_tolerance
https://github.com/sagemath/sage/actions/runs/18576442855/job/52962606814
so the increase in tolerance would be not enough. Maybe there is an actual issue here?
sounds like one of these extremely-difficult-to-debug issue. Given that I also can't reproduce it internally, I'd guess that GitHub CI machines are some virtual machine thing and may need to compete with other virtual machines concurrently running, which would explain the (extreme) fluctuation.
I suspect garbage collector. Let's see if https://github.com/sagemath/sage/pull/41072 helps.
that 2.1566 is unrelated to the change in this pull request (add sig_block) though.
There is a tolerance missing on this test
**********************************************************************
File "src/sage/doctest/util.py", line 846, in sage.doctest.util.inaccuracy_tolerance
Failed example:
with ensure_interruptible_after(2) as data: interruptible_sleep(1r)
Expected:
Traceback (most recent call last):
...
RuntimeError: Function terminates early after 1.00... < 2.0000 seconds
Got:
<BLANKLINE>
Traceback (most recent call last):
File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 734, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 1158, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.doctest.util.inaccuracy_tolerance[9]>", line 1, in <module>
with ensure_interruptible_after(Integer(2)) as data: interruptible_sleep(1)
File "/Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/lib/python3.12/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/util.py", line 904, in ensure_interruptible_after
raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds")
RuntimeError: Function terminates early after 0.9982 < 2.0000 seconds
**********************************************************************
There is a tolerance missing on this test
********************************************************************** File "src/sage/doctest/util.py", line 846, in sage.doctest.util.inaccuracy_tolerance Failed example: with ensure_interruptible_after(2) as data: interruptible_sleep(1r) Expected: Traceback (most recent call last): ... RuntimeError: Function terminates early after 1.00... < 2.0000 seconds Got: <BLANKLINE> Traceback (most recent call last): File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 734, in _run self.compile_and_execute(example, compiler, test.globs) File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 1158, in compile_and_execute exec(compiled, globs) File "<doctest sage.doctest.util.inaccuracy_tolerance[9]>", line 1, in <module> with ensure_interruptible_after(Integer(2)) as data: interruptible_sleep(1) File "/Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/lib/python3.12/contextlib.py", line 144, in __exit__ next(self.gen) File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/util.py", line 904, in ensure_interruptible_after raise RuntimeError(f"Function terminates early after {elapsed:.4f} < {seconds:.4f} seconds") RuntimeError: Function terminates early after 0.9982 < 2.0000 seconds **********************************************************************
This has been fixed now in my PR https://github.com/sagemath/sage/pull/41263. And seems unrelevant with this PR. So I set it to positive.