On Wed, Feb 6, 2019 at 10:29 AM jonathan.kliem via sage-devel
<sage-devel@googlegroups.com> wrote:
>
> sage: alarm(1)
> sage:
>
> AlarmInterrupt escaped interact()
>
> sage:
> sage:
> ^[[50;1R
> **********************************************************************
>
> Oops, Sage crashed. We do our best to make it stable, but...
>
> ...
>
> Is this supposed to happen?

I think obviously not :)

I can confirm the same.  It's not clear how long this has been the
case--it looks to me like a bug/oddity in IPython?

The exception is originating from IPython.terminal.interactiveshell
which contains the following:

    def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED):
        # An extra layer of protection in case someone mashing Ctrl-C breaks
        # out of our internal code.
        if display_banner is not DISPLAY_BANNER_DEPRECATED:
            warn('mainloop `display_banner` argument is deprecated
since IPython 5.0. Call `show_banner()` if needed.',
DeprecationWarning, stacklevel=2)
        while True:
            try:
                self.interact()
                break
            except KeyboardInterrupt as e:
                print("\n%s escaped interact()\n" % type(e).__name__)
            finally:
                # An interrupt during the eventloop will mess up the
                # internal state of the prompt_toolkit library.
                # Stopping the eventloop fixes this, see
                # https://github.com/ipython/ipython/pull/9867
                if hasattr(self, '_eventloop'):
                    self._eventloop.stop()

Which is being reached because AlarmInterrupt is a subclass of
KeyboardInterrupt .   I don't know why this doesn't happen then when,
say, mashing Ctrl-C.  I guess because IPython installs its own SIGINT
handler or something.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to