New submission from STINNER Victor <vstin...@python.org>:

_PyInterpreterState_DeleteExceptMain() contains the following check:

    PyThreadState *tstate = _PyThreadState_Swap(gilstate, NULL);
    if (tstate != NULL && tstate->interp != runtime->interpreters->main) {
        return _PyStatus_ERR("not main interpreter");
    }

os.fork() is allow in subinterpreters and PyOS_AfterFork_Child() doesn't seem 
to update runtime->interpreters->main.

Either we should update runtime->interpreters->main after fork in the child 
process, or os.fork() should be denied in subinterpreters.

In bpo-37266, I denied the creation of daemon threads in subinterpreters. But I 
had to revert this change: see bpo-40234.

----------
components: Subinterpreters
messages: 380891
nosy: vstinner
priority: normal
severity: normal
status: open
title: [subinterpreters] Deny os.fork() in subinterpreters?
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42346>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to