Message380892
> SIGNAL_PENDING_CALLS() is called on a Python thread via signal.raise_signal() or _thread.interrupt_main() / PyErr_SetInterrupt(). If you'd rather keep the COMPUTE_EVAL_BREAKER() call in that case, the console control-event case can be distinguished via PyGILState_GetThisThreadState(). It returns NULL if there's no thread state, i.e. WINAPI TlsGetValue returns NULL.
That sounds like a micro-optimization which is not worth it. The code is already quite complicated. I don't think that it's a big deal to call eval_frame_handle_pending() *once* when a signal is received whereas the "current" Python thread cannot handle it. This function is quite simple: when there is no nothing to do, it only reads 3 atomic variable and one tstate attribute. It's cheap. |
|
Date |
User |
Action |
Args |
2020-11-13 14:30:47 | vstinner | set | recipients:
+ vstinner, gvanrossum, paul.moore, tim.golden, Mark.Shannon, zach.ware, serhiy.storchaka, eryksun, steve.dower, miss-islington |
2020-11-13 14:30:47 | vstinner | set | messageid: <1605277847.47.0.293468626368.issue42296@roundup.psfhosted.org> |
2020-11-13 14:30:47 | vstinner | link | issue42296 messages |
2020-11-13 14:30:47 | vstinner | create | |
|