]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613)
authorVictor Stinner <vstinner@python.org>
Wed, 3 Jun 2020 15:49:25 +0000 (17:49 +0200)
committerGitHub <noreply@github.com>
Wed, 3 Jun 2020 15:49:25 +0000 (17:49 +0200)
commit5d2396c8cf68fba0a949c6ce474a505e3aba9c1f
tree5a0ebd090249175530372137c2ba465f2c020c4e
parenta125561397c80a30db74f6ac289781fb53af9196
[3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613)

* 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)
Include/internal/pycore_pystate.h
Lib/test/test_repl.py
Misc/NEWS.d/next/Core and Builtins/2020-06-01-20-31-07.bpo-40826.XCI4M2.rst [new file with mode: 0644]
Modules/signalmodule.c
Parser/myreadline.c