New submission from Eric Snow <ericsnowcurren...@gmail.com>:
The code in Modules/signalsmodule.c (as well as a few other places in the code) has a concept of a "main" thread. It's the OS thread where Py_Initialize() was called (and likely the process's original thread). For various good reasons, we ensure that signal handling happens relative to that ("main") thread. The problem is that we track the OS thread (by ID), which multiple interpreters can share. What we really want is to track the original PyThreadState. Otherwise signal-handling could happen (or handlers get added) in the wrong interpreter. Options: 1. track the PyThreadState pointer instead of the OS thread ID 2. check that the current interpreter is the main one, in every place we check for the main thread >From what I can tell, the simpler option is #2. ---------- components: Interpreter Core messages: 333506 nosy: eric.snow priority: normal severity: normal stage: needs patch status: open title: Check for main interpreter when checking for "main" thread (for signal handling) type: behavior versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35724> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com