In fact I don't understand alarm(...) at all. Maybe it works better on linux or older OS X releases, but on the OS X machines to which I have access, it feels broken. If I do:
sage: alarm(0.3)
then after 0.3 seconds I see a message
KeyboardInterrupt escaped interact()
That's fine. But then the next command I issue tends to get interrupted:
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.3.beta2, Release Date: 2023-12-13 │
│ Using Python 3.11.6. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: alarm(0.3)
sage:
KeyboardInterrupt escaped interact()
sage: identity_matrix(10)
---------------------------------------------------------------------------
AlarmInterrupt Traceback (most recent call last)
Cell In[2], line 1
----> 1 identity_matrix(Integer(10))
...
Why? The alarm should have already happened. As I said before, if I exit Sage, then it does not do so gracefully. Furthermore, if instead of exiting I issue a second alarm, Sage crashes:
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.3.beta2, Release Date: 2023-12-13 │
│ Using Python 3.11.6. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: alarm(0.3)
sage:
KeyboardInterrupt escaped interact()
sage: alarm(0.3)
sage:
KeyboardInterrupt escaped interact()
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/local/Cellar/pyt...@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py", line 1250, in is_dir
return S_ISDIR(self.stat().st_mode)
^^^^^^^^^
AttributeError: 'str' object has no attribute 'stat'
Original exception was:
Traceback (most recent call last):
File "/Users/palmieri/Sage/TESTING/sage-10.3.beta2/src/bin/sage-ipython", line 16, in <module>
app.start()
File "/Users/palmieri/Sage/TESTING/sage-10.3.beta2/local/var/lib/sage/venv-python3.11/lib/python3.11/site-packages/IPython/terminal/ipapp.py", line 317, in start
self.shell.mainloop()
File "/Users/palmieri/Sage/TESTING/sage-10.3.beta2/local/var/lib/sage/venv-python3.11/lib/python3.11/site-packages/IPython/terminal/interactiveshell.py", line 899, in mainloop
self.restore_term_title()
File "/Users/palmieri/Sage/TESTING/sage-10.3.beta2/local/var/lib/sage/venv-python3.11/lib/python3.11/site-packages/IPython/terminal/interactiveshell.py", line 602, in restore_term_title
restore_term_title()
File "/Users/palmieri/Sage/TESTING/sage-10.3.beta2/local/var/lib/sage/venv-python3.11/lib/python3.11/site-packages/IPython/utils/terminal.py", line 115, in restore_term_title
_restore_term_title()
File "/Users/palmieri/Sage/TESTING/sage-10.3.beta2/local/var/lib/sage/venv-python3.11/lib/python3.11/site-packages/IPython/utils/terminal.py", line 83, in _restore_term_title_xterm
assert _xterm_term_title_saved
AssertionError
Something seems to be pretty broken.