GNU bug report logs -
#76943
30.1; comint-interrupt-subjob does not interrupt process in inferior-python
Previous Next
Reported by: Garid Zorigoo <garidzorigoo <at> gmail.com>
Date: Tue, 11 Mar 2025 15:28:01 UTC
Severity: normal
Found in version 30.1
Done: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #23 received at 76943 <at> debbugs.gnu.org (full text, mbox):
Ping! Paul, could you please chime in?
> Cc: 76943 <at> debbugs.gnu.org, mattias.engdegard <at> gmail.com, garidzorigoo <at> gmail.com
> Date: Thu, 13 Mar 2025 18:49:09 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
>
> > Date: Fri, 14 Mar 2025 01:13:29 +0900
> > From: kobarity <kobarity <at> gmail.com>
> > Cc: Garid Zorigoo <garidzorigoo <at> gmail.com>,
> > 76943 <at> debbugs.gnu.org
> >
> > Eli Zaretskii wrote:
> > >
> > > > From: Garid Zorigoo <garidzorigoo <at> gmail.com>
> > > > Date: Thu, 13 Mar 2025 11:04:23 +0900
> > > >
> > > >
> > > > I found a work around, not sure how & why.
> > > > Changing the value of comint-ptyp seems to make comint-interrupt-subjob work:
> > > >
> > > > (setq comint-ptyp nil)
> > > >
> > > > Hope this helps.
> > > >
> > > > I believe that inferior-python should be able to interrupt subjobs
> > > > by default (i.e. without the user changing the above variable value).
> > >
> > > kobarity, any comments or suggestions?
> >
> > This turned out to be an effect of the setting to make the tty RAW,
> > which Mattias and I did as part of #68559.
> >
> > (defconst python-shell-setup-code
> > "\
> > try:
> > import tty
> > except ImportError:
> > pass
> > else:
> > tty.setraw(0)"
> > "Code used to setup the inferior Python processes.")
> >
> > This is to disable echo back on MacOS, so there is a workaround to
> > limit this setting to MacOS only. That would not solve the
> > `comint-interrupt-subjob' problem on MacOS, though.
> >
> > `comint-ptyp' is passed as the CURRENT-GROUP argument of
> > `interrupt-process' function. It is finally processed by the
> > process_send_signal function in process.c. If CURRENT-GROUP is
> > non-nil, it first try to send the control character instead of sending
> > the signal. However, I believe the control character is ignored
> > because tty is set to RAW by the above code.
> >
> > I feel it would be better for process_send_signal to check if the tty
> > is RAW, but I am not sure if that is appropriate.
>
> Paul, WDYT about this?
>
> > Since process_send_signal checks whether control characters such as
> > VINTR are valid, we can also avoid this problem by disabling VINTR as
> > follows.
> >
> > (defconst python-shell-setup-code
> > "\
> > try:
> > import tty
> > import termios
> > except ImportError:
> > pass
> > else:
> > tty.setraw(0)
> > attr = termios.tcgetattr(0)
> > attr[-1][termios.VINTR] = b'\x00'
> > termios.tcsetattr(0, termios.TCSANOW, attr)"
> > "Code used to setup the inferior Python processes.")
> >
> > In summary, there are at least four possible options.
> >
> > 1. Set `comint-ptyp' to nil.
> > 2. Improve process_send_signal to check if tty is RAW.
> > 3. Disable VINTR in addition to making the tty RAW.
> > 4. Do not set tty to RAW except on MacOS.
> >
> > If we choose 4, I believe MacOS requires one of 1-3.
>
> Thanks.
>
> Let's see what Paul thinks about this, and take it from there.
>
>
>
>
This bug report was last modified 32 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.