]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-39984: Move pending calls to PyInterpreterState (GH-19066)
authorVictor Stinner <vstinner@python.org>
Thu, 19 Mar 2020 01:41:21 +0000 (02:41 +0100)
committerGitHub <noreply@github.com>
Thu, 19 Mar 2020 01:41:21 +0000 (02:41 +0100)
commit50e6e991781db761c496561a995541ca8d83ff87
tree3380890960438581d8262ad24e2c8b346d664c87
parent3cde88439d542ed8ca6395acc8dfffd174ecca18
bpo-39984: Move pending calls to PyInterpreterState (GH-19066)

If Py_AddPendingCall() is called in a subinterpreter, the function is
now scheduled to be called from the subinterpreter, rather than being
called from the main interpreter.

Each subinterpreter now has its own list of scheduled calls.

* Move pending and eval_breaker fields from _PyRuntimeState.ceval
  to PyInterpreterState.ceval.
* new_interpreter() now calls _PyEval_InitThreads() to create
  pending calls lock.
* Fix Py_AddPendingCall() for subinterpreters. It now calls
  _PyThreadState_GET() which works in a subinterpreter if the
  caller holds the GIL, and only falls back on
  PyGILState_GetThisThreadState() if _PyThreadState_GET()
  returns NULL.
Doc/c-api/init.rst
Doc/whatsnew/3.9.rst
Include/internal/pycore_pystate.h
Misc/NEWS.d/next/Core and Builtins/2020-03-19-00-45-37.bpo-39984.u-bHIq.rst [new file with mode: 0644]
Modules/signalmodule.c
Python/ceval.c
Python/ceval_gil.h
Python/pylifecycle.c