This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Jurko.Gospodnetić, barry, eric.araujo, eric.snow, fossilet, neologix, pitrou, poq, r.david.murray, telmich, vstinner
Date 2013-12-21.14:45:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Sorry, but I don't understand this issue. Well, I understood the issue as "When I press CTRL+c to interrupt Python, Python does exit". What's wrong with that? Why do you send CTRL+c if you don't want Python to exit?

Using custom signal handler (SIG_IGN), it would be possible to ignore SIGINT during Python initialization. Using pthread_sigmask(), it is possible to defer the handling of the signal until user is able to setup its own custom signal handler (or just use try/except KeyboardInterrupt). But I don't like these options. I would like to be able to kill (stop) Python as early as possible with CTRL+c.

If you are only worried by the long traceback when importing the site module is interrupted, you can use -S. On UNIX, you can then use signal.pthread_sigmask() to defer the handling of SIGINT.

The whole issue remembers me the dummy question: "is the finally block executed even if I unplug the power cable?".


This issue can be solved using python -S, calling signal.signal(SIGINT, signal.SIG_DFL) and then import the site module manually.
Date User Action Args
2013-12-21 14:45:04vstinnersetrecipients: + vstinner, barry, pitrou, fossilet, eric.araujo, r.david.murray, neologix, Jurko.Gospodnetić, eric.snow, poq, telmich
2013-12-21 14:45:04vstinnersetmessageid: <>
2013-12-21 14:45:04vstinnerlinkissue14228 messages
2013-12-21 14:45:03vstinnercreate