STINNER Victor <victor.stin...@haypocalc.com> added the comment:

Dummy question: why don't you use KeyboardInterrupt instead of a custom SIGINT 
handler?

try:
    for i in range(1000000):
        print(i)
except KeyboardInterrupt:
    print("got sigint")

Python SIGINT handler raises a KeyboardInterrupt (the handler is written in C, 
not in Python) which is safe, whereas writing to sys.stdout doesn't look to be 
a good idea :-)

----------
nosy: +haypo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10478>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to