Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e0b0c06
Fix segmentation fault in libgap function call
user202729 Aug 15, 2025
4d1f19f
Code modification to avoid calling GapElement.__dealloc__ too early
user202729 Aug 15, 2025
c6b76b6
src/sage/libs/gap/gap_includes.pxd: add InterruptExecStat
orlitzky Aug 17, 2025
f9c186d
src/sage/libs/gap/util.pyx: add gap_sig_on / gap_sig_off
orlitzky Aug 17, 2025
a9473ca
src/sage/libs/gap/util.pyx: replace sig_on / sig_off
orlitzky Aug 17, 2025
fc16eae
src/sage/libs/gap/element.pyx: replace sig_on / sig_off
orlitzky Aug 17, 2025
a887924
src/sage/libs/gap/meson.build: remove cysignals dependency
orlitzky Aug 17, 2025
a219ac9
src/sage/libs/gap/libgap.pyx: update signal handling docs
orlitzky Aug 17, 2025
0b66eba
src/sage/doctest/util.py: handle Ctrl-C from GAP
orlitzky Aug 17, 2025
e1e8d62
src/sage/libs/gap/gap_includes.pxd: drop sig_GAP_Enter()
orlitzky Aug 17, 2025
2ca060f
src/sage/libs/gap/libgap.pyx: rewrite signal handling explanation
orlitzky Aug 17, 2025
7c48f94
src/sage/libs/gap/util.pyx: do KeyboardInterrupt conversion earlier
orlitzky Aug 18, 2025
fb458ad
src/sage/doctest/util.py: update GAP workaround
orlitzky Aug 18, 2025
51c81b0
src/sage/libs/gap: remove redundant KeyboardInterrupt hacks
orlitzky Aug 18, 2025
bab97f6
src/sage/libs/gap/util.pyx: type-safety for InterruptExecStat()
orlitzky Aug 18, 2025
b298ca8
src/sage/doctest/util.py: further simplify GAP workaround
orlitzky Aug 18, 2025
867cf66
src/sage/libs/gap/libgap.pyx: explain error handling
orlitzky Aug 18, 2025
cd93bdf
src/sage/libs/gap/util.pyx: delete old commented debug statement
orlitzky Aug 19, 2025
794b427
src/sage/libs/gap: use public API for is_string()
orlitzky Aug 19, 2025
ee6af07
src/sage/libs/gap/element.pyx: missing GAP_Enter / GAP_Leave
orlitzky Aug 19, 2025
e7bb222
src/sage/libs/gap/element.pyx: drop superclass list -> sage conversion
orlitzky Aug 19, 2025
d9bd3c2
src/sage/libs/gap: be more careful inside make_any_gap_element()
orlitzky Aug 19, 2025
e79bdd7
src/sage/libs/gap/element.pyx: revert list-of-char changes
orlitzky Aug 20, 2025
3220d8f
src/sage/libs/gap/libgap.pyx: more realistic "real" example
orlitzky Aug 20, 2025
24065b5
src/sage/libs/gap/libgap.pyx: clarify "GAP library usage"
orlitzky Aug 20, 2025
041fcdf
src/sage/libs/gap/libgap.pyx: fix module docstring indentation
orlitzky Aug 20, 2025
50157d7
src/sage/libs/gap/libgap.pyx: more module docstring tweaks
orlitzky Aug 21, 2025
b550b36
src/sage/libs/gap/util.pyx: add missing noexcept annotation
orlitzky Aug 21, 2025
677c2f1
src/sage/libs/gap/element.pyx: more tolerance in Ctrl-C tests
orlitzky Aug 21, 2025
1af02c2
src/sage/libs/gap: special case for bool in make_any_gap_element()
orlitzky Aug 21, 2025
f39be09
src/sage/libs/gap/element.pyx: update make_any_gap_element() comment
orlitzky Aug 21, 2025
36da2ca
src/sage/libs/gap/element.pyx: faster list length check
orlitzky Aug 21, 2025
3a6d006
src/sage/libs/gap/libgap.pyx: slightly safer example
orlitzky Aug 21, 2025
8b8c496
src/sage/rings/complex_arb.pyx: add some Ctrl-C tolerance to a doctest
orlitzky Aug 21, 2025
6e74192
src/sage/libs/gap/libgap.pyx: unindent the "Using the .. library" docs
orlitzky Aug 23, 2025
47826c2
src/sage/libs/gap/libgap.pyx: unindent the AUTHORS block
orlitzky Aug 23, 2025
c1adeb9
src/sage/libs/gap/libgap.pyx: backticks for ``libgap-api.h``
orlitzky Aug 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/sage/doctest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,16 @@ def ensure_interruptible_after(seconds: float, max_wait_after_interrupt: float =

try:
yield data
except AlarmInterrupt as e:
e.__traceback__ = None # workaround for https://github.com/python/cpython/pull/129276
alarm_raised = True
except KeyboardInterrupt as e:
# AlarmInterrupt is a subclass of KeyboardInterrupt, so this
# catches both. The "user interrupt" message is a quirk of
# GAP interrupts that result from SIGALRM.
if isinstance(e, AlarmInterrupt) or "user interrupt" in str(e):
# workaround for https://github.com/python/cpython/pull/129276
e.__traceback__ = None
alarm_raised = True
else:
raise
Copy link
Contributor

@user202729 user202729 Aug 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the logic below (raise AlarmInterrupt instead of KeyboardInterrupt) are correctly implemented, this change wouldn't be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've further simplified this down to a one-line change, using the fact that AlarmInterrupt is a subclass of KeyboardInterrupt. Instead of catching AlarmInterrupt, we can catch KeyboardInterrupt, and then check,

  • is it an AlarmInterrupt?
  • does it have "user interrupt" as the message?

I prefer this to hacking AlarmInterrupt into the GAP code at this point because sage.libs.gap is otherwise free of cysignals. To raise the AlarmInterrupt from sage.libs.gap we'd have to,

  1. Add cysignals back as a dep in meson.build
  2. Import AlarmInterrupt
  3. Add the global last_signal variable
  4. Set last_signal whenever a handler is called
  5. Check last_signal when raising a GAPError and convert it to the right thing

Since this is all for the benefit of one doctest method, it just seems easier to add the one line in that doctest method?

finally:
before_cancel_alarm_elapsed = walltime() - start_time
cancel_alarm()
Expand Down
Loading
Loading