except block isn't catching exception

Cameron Simpson cs at zip.com.au
Sat Aug 8 11:02:59 CEST 2015


On 08Aug2015 18:17, Chris Angelico <rosuav at gmail.com> wrote:
>On Sat, Aug 8, 2015 at 6:11 PM, Cameron Simpson <cs at zip.com.au> wrote:
>> From:
>>
>>
>> https://docs.python.org/3/library/signal.html#execution-of-python-signal-handlers
>>
>> we have:
>>
>>  A Python signal handler does not get executed inside the low-level (C)
>> signal  handler. Instead, the low-level signal handler sets a flag which
>> tells the  virtual machine to execute the corresponding Python signal
>> handler at a later  point(for example at the next bytecode instruction).
>
>Ah, thanks. Most importantly, though: Is there anything in the
>*language spec*, or is this a CPython implementation detail?

Signals aren't part of the language spec, surely? Though part of the stdlib 
clearly.

I'd say the above text from the signal module doco was written from the 
viewport of CPython, though it is loose enough in terminology (==> allows 
freedom to implementors) to read like generic Python spec than CPython detail.

The other bit of text I quoted:

  Python signal handlers are always executed in the main Python thread, even
  if the signal was received in another thread.

also reads like specification.

No, I can't prove any of this. It is just how I read the signal module 
documentation.

Cheers,
Cameron Simpson <cs at zip.com.au>

No good deed shall go unpunished!       - David Wood <davewood at teleport.com>


More information about the Python-list mailing list