mirror of
https://github.com/python/cpython
synced 2026-09-29 09:05:29 +03:00
Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted
(EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch written by Charles-Francois Natali.
This commit is contained in:
parent
e1292a25d8
commit
52c950f229
2 changed files with 9 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ static int
|
|||
my_fgets(char *buf, int len, FILE *fp)
|
||||
{
|
||||
char *p;
|
||||
for (;;) {
|
||||
while (1) {
|
||||
if (PyOS_InputHook != NULL)
|
||||
(void)(PyOS_InputHook)();
|
||||
errno = 0;
|
||||
|
|
@ -85,9 +85,10 @@ my_fgets(char *buf, int len, FILE *fp)
|
|||
#ifdef WITH_THREAD
|
||||
PyEval_SaveThread();
|
||||
#endif
|
||||
if (s < 0) {
|
||||
return 1;
|
||||
}
|
||||
if (s < 0)
|
||||
return 1;
|
||||
/* try again */
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (PyOS_InterruptOccurred()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue