[Python-Dev] Questions about signal handling.

Yury Selivanov yselivanov.ml at gmail.com
Mon Sep 24 17:10:27 EDT 2018


On Mon, Sep 24, 2018 at 4:19 PM Eric Snow <ericsnowcurrently at gmail.com> wrote:
[..]
> Is there a good place where this weirdness is documented?

I'll need to look through uvloop & libuv commit log to remember that;
will try to find time tonight/tomorrow.

[..]
> This matters to me because I'd like to use "pending" calls for
> subinterpreters, which means dealing with signals *in*
> Py_MakePendingCalls() is problematic.  Pulling the
> PyErr_CheckSignals() call out would eliminate that problem.

Py_MakePendingCalls is a public API, even though it's not documented.
If we change it to not call PyErr_CheckSignals and if there are C
extensions that block pure Python code execution for long time (but
call Py_MakePendingCalls explicitly), such extensions would stop
reacting to ^C.

Maybe a better workaround would be to introduce a concept of "main"
sub-interpreter? We can then fix Py_MakePendingCalls to only check for
signals when it's called from the main interpreter.

Yury


More information about the Python-Dev mailing list