Hi,

I wrote patches for the issue #3137 and I would like your opinion about my 
solution (not directly about the patches): I propose to consider a SIGINT 
during startup as a fatal error. If you press CTRL+c while Python is starting, 
Python displays an error and exit with the code 1.

Currently, if you press CTRL+c while Python is starting: the SIGINT signal 
will be *ignored* somewhere between Python initialization and the first Python 
instruction. First problem is that if site import is interrupted, Python is 
not completly initialized (if a SIGINT is sent just after the call to 
initsigs(), initsite() is completly skipped).

Example:
------------------
$ python
^C
Traceback (most recent call last):                                              
                                                       
  File "/home/SHARE/SVN/python-trunk/Lib/site.py", line 62, in <module>         
                                                       
    import os                                                                   
                                                       
  File "/home/SHARE/SVN/python-trunk/Lib/os.py", line 44, in <module>           
                                                       
    from posix import *                                                         
                                                       
KeyboardInterrupt         
$ echo $?
1
------------------

It's not easy to reproduce this issue because Python initialization is really 
fast (yeah really! or at least to fast for me ;-)). I'm using "valgrind --log-
file=/dev/null ./python -v" to simulate a very slow computer :-)

-- 
Victor Stinner
http://www.haypocalc.com/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to