title: How does python process a signal?
body: <p>What is the workflow of processing a signal in python ? I set a signal handler, when the signal occur ,how does python invoke my function? Does the OS invoke it just like C program?
  If I am in a C extend of python ,is it interrupted immediately ?</p>
  
  <hr>
  
  <p>Now it's clear to me how does python process handle a signal . When you set a signal by the signal module , the module will register a function signal_handler(see $src/Modules/signalmodule.c) ,which set your handler and flag it as 1(<code>Handlers[sig_num].tripped = 1;</code>) , then call Py_AddPendingCall to tell python interpreter. The python interpreter will invoke Py_MakePendingCalls to call PyErr_CheckSignals which calls your function in main loop(see $src/Python/ceval.c).
  communicate me if you want to talk about this : renenglish@gmail.com</p>