Builtin input does not always correctly handle errors from PyOS_Readline
#134644
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-crash
A hard crash of the interpreter, possibly with a core dump
Uh oh!
There was an error while loading. Please reload this page.
Assertion failure sending
SIGINT
while callinginput
Note, this is a modified version of the example code in #112585.
Python (tested
v3.12.10
,v3.13.3
,v3.14.0b1
, and currentHEAD
), built with assertions enabled:IIUC the issue is
builtin_input_impl
inPython/bltinmodule.c
callsPyOS_Readline
but assumes it cannot set an exception:If
PyOS_Readline
sets an exception (e.g. as in this case by running an interrupt signal handler itself), as opposed to being interrupted by a signal and returningNULL
without setting the exception, and another signal with a handler is pending whenPyErr_CheckSignals()
is called, the handler will be called with the prior exception already set, and hence the assertion fails.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
No response
Linked PRs
PyOS_Readline
#134645The text was updated successfully, but these errors were encountered: