This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients paul.moore, petr.viktorin, steve.dower, tim.golden, vstinner, zach.ware
Date 2021-04-16.17:28:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1618594085.82.0.157931032949.issue43868@roundup.psfhosted.org>
In-reply-to
Content
Yes, please remove it from the limited C API.

PyOS_ReadlineFunctionPointer has a bad API. I fixed recently PyOS_StdioReadline because it used the Python C API without holding the GIL. To acquire the GIL, you need to access a *private* _PyOS_ReadlineTState variable which is kind of unfortunate :-(

commit c353764fd564e401cf47a5d9efab18c72c60014e
Author: Victor Stinner <vstinner@python.org>
Date:   Mon Jun 1 20:59:35 2020 +0200

    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.

See also:

commit fa7ab6aa0f9a4f695e5525db5a113cd21fa93787
Author: Victor Stinner <vstinner@python.org>
Date:   Wed Jun 3 14:39:59 2020 +0200

    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.
History
Date User Action Args
2021-04-16 17:28:05vstinnersetrecipients: + vstinner, paul.moore, tim.golden, petr.viktorin, zach.ware, steve.dower
2021-04-16 17:28:05vstinnersetmessageid: <1618594085.82.0.157931032949.issue43868@roundup.psfhosted.org>
2021-04-16 17:28:05vstinnerlinkissue43868 messages
2021-04-16 17:28:05vstinnercreate