summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-03 16:28:18 (GMT)
committerGitHub <noreply@github.com>2020-06-03 16:28:18 (GMT)
commit6f7346bb3983cd7a6aa97eeeafffb3cecd5292b8 (patch)
treeb3a394496c408eb13503cc90c1a8bfef294f1a0a /Include
parent5b8787ef191864cd2313015959bcc3e10711aaff (diff)
downloadcpython-6f7346bb3983cd7a6aa97eeeafffb3cecd5292b8.zip
cpython-6f7346bb3983cd7a6aa97eeeafffb3cecd5292b8.tar.gz
cpython-6f7346bb3983cd7a6aa97eeeafffb3cecd5292b8.tar.bz2
[3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613) (GH-20616)
* bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20579) Fix GIL usage in PyOS_Readline(): lock the GIL to set an exception. Pass tstate to my_fgets() and _PyOS_WindowsConsoleReadline(). Cleanup these functions. (cherry picked from commit c353764fd564e401cf47a5d9efab18c72c60014e) * bpo-40826: Add _PyOS_InterruptOccurred(tstate) function (GH-20599) my_fgets() now calls _PyOS_InterruptOccurred(tstate) to check for pending signals, rather calling PyOS_InterruptOccurred(). my_fgets() is called with the GIL released, whereas PyOS_InterruptOccurred() must be called with the GIL held. test_repl: use text=True and avoid SuppressCrashReport in test_multiline_string_parsing(). Fix my_fgets() on Windows: fgets(fp) does crash if fileno(fp) is closed. (cherry picked from commit fa7ab6aa0f9a4f695e5525db5a113cd21fa93787)
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_pystate.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index f90e7e1..96d5e31 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -317,6 +317,9 @@ PyAPI_FUNC(void) _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime);
PyAPI_FUNC(void) _PyGILState_Reinit(_PyRuntimeState *runtime);
+
+PyAPI_FUNC(int) _PyOS_InterruptOccurred(PyThreadState *tstate);
+
#ifdef __cplusplus
}
#endif