[Patches] [ python-Patches-466877 ] SIGBREAK is missing from signal module

noreply@sourceforge.net noreply@sourceforge.net
Mon, 01 Oct 2001 10:27:24 -0700


Patches item #466877, was opened at 2001-10-01 09:07
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=466877&group_id=5470

Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Steven Scott (progoth)
>Assigned to: Tim Peters (tim_one)
Summary: SIGBREAK is missing from signal module

Initial Comment:
I didn't know if this belonged in Core or Modules.  
It's a trivial change, but I needed it for a project I 
was working on.  I couldn't find any mention of using 
SIGBREAK with python online, so maybe it's not 
supported?  It seems to work fine in the tests I've 
done, although they were nothing extensive.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-10-01 10:27

Message:
Logged In: YES 
user_id=31435

Yes to everything <wink>:  SIGBREAK is unique to Windows, 
you can catch it, the default handler calls ExitProcess(), 
and Python should support it.

Assigned to me, but I'm not in favor of changing its 
default handler:  if a process has gone wild, killing it 
via Task Manager is Draconian (that's like os._exit() -- no 
cleanup at all is done).  ExitProcess() at least attempts 
to clean up shared OS resources correctly, and since Python 
has already hijacked Ctrl+C (whose default handler also 
calls ExitProcess()), Ctrl+Break is the only "semi-clean 
panic shutdown" gimmick left to the user.  It's good to let 
the user override that, but Python shouldn't presume to 
change all of Windows default behaviors to make Unix geeks 
feel more at home <0.9 wink>.

----------------------------------------------------------------------

Comment By: Steven Scott (progoth)
Date: 2001-10-01 09:52

Message:
Logged In: YES 
user_id=61663

haha I guess I'm not really up on all the unix stuff 
either:)  so yeah, you can catch it, it would probably be 
useful to have it handled the same as SIGINT, and throw the 
KeyboardInterrupt exception.  Or maybe it shouldn't be the 
same, I would worry about how other people are using it, 
but since the issue hasn't even arisen until now...

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-01 09:44

Message:
Logged In: YES 
user_id=6380

Aha. Can you actually catch SIGBREAK? (If so, it's not quite
kill -9 :-)

This might be useful -- we might want to set the default
handler for SIGBREAK that does the same thing as the SIGINT
handler.

----------------------------------------------------------------------

Comment By: Steven Scott (progoth)
Date: 2001-10-01 09:38

Message:
Logged In: YES 
user_id=61663

unfortunately I work in a windows-only shop, and that's 
what I'm doing this for.  I was trying my hardest to figure 
out how to catch a CTRL-Break and not just a CTRL-C, and I 
looked in microsoft's signals.h and saw SIGBREAK.  I assume 
it's a windows only thing.  I'm not really up on all the 
windows stuff, but apparently CTRL-Break is a way to take 
things down harder, I don't know, kill -9 for dos, or 
something.  it doesn't raise a KeyboardException (I'm doing 
this with python 1.5, but the patch is against CVS), but it 
does allow the signal handler to be called in lieu of 
exiting the interpreter.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-01 09:22

Message:
Logged In: YES 
user_id=6380

What is SIGBREAK? I don't see it in the Linux man page for
signal(7).

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=466877&group_id=5470