Newsgroups: comp.lang.python
From: Philip Semanchuk <phi...@semanchuk.com>
Date: Sat, 20 Jun 2009 16:30:58 -0400
Local: Sat, Jun 20 2009 4:30 pm
Subject: Re: KeyboardInterrupt eats my error and then won't be caught
On Jun 20, 2009, at 7:41 AM, Piet van Oostrum wrote: > After my previous experiment I was curious how this works with Thank you Greg and especially Piet for going to the trouble of > input(). I replaced the sem.acquire() with raw_input() and ran the > same > tests. Now the inner exception is really taken so it works like the OP > expected. The exception, however is KeyboardInterrupt, not the special > exception from the IPC module. > So I looked in the source code how they did it: > This code for input in function calls PyErr_CheckSignals() and installing posix_ipc and experimenting with it. Piet, your research into raw_input() gave me a solution. In my C code, I added a call to PyErr_CheckSignals() as the first line Prior to adding the call to PyErr_CheckSignals(), PyErr_Occurred() Best of all, PyErr_CheckSignals() doesn't interfere with a Python- This worked under OS X and Linux. I'll have to think some more about exactly how I want my module to Thanks again for your invaluable assistance. If I'm ever in NL or NZ Cheers You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||