control-c and threads, signals in 2.3 causing all sorts of issues

Michael Hudson mwh at python.net
Thu Feb 19 13:41:30 CET 2004


Srikanth Mandava <Srikanth.Mandava at cosinecom.com> writes:

> 	Hi!
> 
> 	 When a signal handler is registered in the main thread and
> 	 "control-c" is entered, the child thread is getting the
> 	 KeyboardInterrupt exception(The documentation says the main thread
> 	 MUST receive the signal handler function call if handler is
> 	 registered). 

Hmm.  Threads + signals == mwh running off screaming...

> 	 In python 2.2.1 the main thread was always called with
> 	 the sigint signal handler which was registered. In my case the
> 	 child thread is waiting on stdin using "raw_input" function. This
> 	 seems to be causing all sorts of strange behavior in the program
> 	 once the child thread gets the keyboardinterrupt exception and
> 	 eventually leading to seg fault on a sys exit .

Oh oh, if you're using raw_input(), readline might be getting
involved...

> 	 Any idea why this is happening in 2.3.1? This scenario worked in
> 	 2.2.1. Is this fixed in 2.3.2?.

Is this thread relavent?

http://groups.google.com/groups?threadm=a6562e06.0401061844.3269da85%40posting.google.com

OS, libc and versions of same might be useful, too.

Cheers,
mwh

-- 
  I located the link but haven't bothered to re-read the article,
  preferring to post nonsense to usenet before checking my facts.
                                      -- Ben Wolfson, comp.lang.python



More information about the Python-list mailing list