mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #14433: Prevent msvcrt crash in interactive prompt when stdin is closed.
This commit is contained in:
parent
b8f02b5a5f
commit
e654c11f56
2 changed files with 7 additions and 1 deletions
|
@ -42,7 +42,10 @@ my_fgets(char *buf, int len, FILE *fp)
|
|||
(void)(PyOS_InputHook)();
|
||||
errno = 0;
|
||||
clearerr(fp);
|
||||
p = fgets(buf, len, fp);
|
||||
if (_PyVerify_fd(fileno(fp)))
|
||||
p = fgets(buf, len, fp);
|
||||
else
|
||||
p = NULL;
|
||||
if (p != NULL)
|
||||
return 0; /* No error */
|
||||
err = errno;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue